How to change MySQL root password from console

To change the MySQL password from console, please follow the mentioned steps:

1. Login to server as root.

2. Kill the MySQL daemons and MySQL processes in the server and run the following commands:

root@server[~]$ pkill mysqld

root@server[~]$ pkill mysql

root@server[~]$ mysqld_safe --skip-grant-tables &

root@server[~]$ mysql -u root

mysql> use mysql;

mysql> UPDATE user SET password=password("newpassword") WHERE user="root";

mysql> flush privileges;

mysql> quit;

3. Restart MySQL service

Note: Replace newpassword by the actual password.

Thank you.

Comments

Popular posts from this blog

SVN: File remains in conflict

HowTo: Enable extended logging for exim

12 tweakings for WHM/cPanel to speed up WordPress