To recover a forgotten root password for MySQL
First, we need to stop the MySQL server process;sudo service mysql stop
Start MySQLwith the following;
sudo mysqld_safe --skip-grant-tables --skip-networking
In another console, connect to the server as root;
mysql -u root
Once connected to the MySQL server, do;
use mysql;
update user set authentication_string=password('NEWPASSWORD') where user='root';
mysql> flush privileges;
quit;
then kill the server with;
killall mysqld or kill -9 PID or something...
You can now restart the server properly with;
servicectl mysqld start or service mysqld start or /etc/rc.d/rc.mysqld start
No comments:
Post a Comment
Note: only a member of this blog may post a comment.