up one level
---
2015-07-01

How to Reset a Linux Server’s MySQL Server Root Password

1. login as linux root user.
2. run command:
service mysql stop
3. run command:
/etc/init.d/mysqld –user=mysql –skip-grant-tables &
4. hit ctrl+c to get back to command prompt
5. login to mysql server with this command:
mysql
6. (now in the mysql monitor) run these commands:
mysql> UPDATE mysql.user SET Password=PASSWORD(‘MyNewPass’)
->                   WHERE User=’root’;
mysql> FLUSH PRIVILEGES;
7. exit the mysql monitor to get back to the linux command line.
8. restart the linux server so that the MySQL server becomes restarted as usual

resources:
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html
http://www.mysqlab.net.../id/4923

a food image:




[2019 edit: Moved to: https://i̶n̶v̶e̶s̶t̶o̶r̶w̶o̶r̶k̶e̶r̶.̶c̶o̶m̶/2015/... .html.]