How to reset MySQL root Password in CWP
When using CWP, there are times when ressetting a root password becomes a problem.
Running the script sh /scripts/mysql_pwd_reset do not work.
In this article i will show you how you can manually change the root password when the scripts fails.
- Kill all mysqld process with the command below:
After, confirm if all all processes associated with mysql, mysqld and maridb have been stopped with the command below.
ps aux|grep mysql
If the output above shows no process, then progress to the next step by running starting mysql and skip all grant tables
If the above command is successful, you can then go ahead to reset the password with the below commands
mysql --user=root mysql
update user set Password=PASSWORD('new-password') where user='root';
- mysql –user=root mysql – start my client and make it possible to run mysql commands
- update user set Password=PASSWORD(‘new-password’) where user=’root’; – This update the root password with a new password indicated with new-password
- flush privileges; – This will reloads the grant tables in the mysql database enabling the changes to take effect without reloading or restarting mysql service
Finally, we can restart mysql
service restart mysql