Reset Root password (MySQL)
From ben.goodacre.name/tech
If the root password for a MySQL server is lost, unknown or cannot be recovered it can be reset so long as you have root (Linux) or Local/Domain Admin (Windows) access on the MySQL server.
Procedure
- Locate your my.conf file - the MySQL configuration file. On Linux it is normally /etc/mysql/my.cnf and it can be located through typing locate my.cnf depnding on what distro you have.
- Stop the MySQL server: /etc/init.d/mysql stop
- Edit the my.cnf file and place the following line after the [mysqld] section:
skip-grant-tables
- Start the MySQL server: /etc/init.d/mysql start
- Now you can connect without a password; all grant commands will not work though. Type the following:
$ mysql -u root
mysql> use mysql;
mysql> update mysql.user set Password=password('newpassword') where User='root'; - Stop the MySQL server: /etc/init.d/mysql stop
- Remove or comment-out the skip-grant-tables line.
- Start the MySQL server: /etc/init.d/mysql start