Just in case you don’t know the password of your MySQL root user anylonger, this is how you can set a new one.
Windows users, follow this guide.
Linux / Unix users: This is for Debian (wheezy) and MySQL 5.5, but should work more or less the same on any linux/unix:
- Stop the MySQL server
service mysql stop
- Create a init file:
- Write the following into this file (adjust the PW):
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('MyNewPassword');
- Restart MySQL with this init-file:
- The new password should work now. Try it:
mysql -u root -p
- Restart MySQL normally:
service mysql restart
- Remove the init-file
And you’re done. I hope this helps somebody.
Note: if it does not work, it is most likely because the MySQL process cannot access the init-file (e.g. because of missing access rights). In this case check your (sys)logs for stuff like this:
mysqld: 130901 14:20:30 [ERROR] /usr/sbin/mysqld: File '/root/mysql-init' not found (Errcode: 13)
I had this problem first because I tried creating the init-file in /root where the mysql-process was not able to read it.