We can change the mysql root password from the WHM by using the steps provided at WHM DOCS but if server is not having control panel or not having WHM access then refer to the following steps to reset the mysql root password.
First make sure that mysql service is stop
/etc/init.d/mysql stop
Now run the following command from the shell.
/usr/bin/safe_mysqld –skip-grant-tables
If the above command runs successfully then refer to the following command.
/usr/bin/mysqld_safe –skip-grant-tables &
mysql -u rootmysql> use mysql;
mysql> update user set Password = PASSWORD(‘supp0rt123′) where User=’root’;
mysql> exit
Now restart the mysql service
/etc/init.d/mysqld stop
/etc/init.d/mysqld start