How to reset root’s MySQL password?

[root@server /]# service mysqld stop
[root@server /]# /usr/bin/safe_mysqld –skip-grant-tables&
[root@mail mrtg]# mysql mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.58

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.

mysql> UPDATE user SET Password=PASSWORD(‘your_new_root_password’)
-> WHERE Host=’localhost’ AND User=’root’;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0

mysql> exit;
Bye
[root@server /]# service mysqld restart

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.