You can reinit the password :
1.stop mysql
2.start mysql safe :
- mysqld_safe--skip - grant - tables &
3.connect to mysql
4.change the password
- mysql > use mysql;
- mysql > update user set password = PASSWORD("YOUR_PASSWORD") where user = 'root';
- mysql > flush privileges;
- mysql > quit
5.stop mysql
6.start mysql
- /
- etc
- /
- init
- .
- d/mysql start
Then you can connect to mysql with login root and the new password.
来源: http://www.bubuko.com/infodetail-2449995.html