问题
How do I reset the root pwd and account in MySQL as I was following instructions how to grant priveledges for other servers and accidently tied root user (Mysql) to other ip address and now it seems that I can not log in as admin on localhost?
Thanks
回答1:
You have 3 ways to reset rootpass in mysql:
1 - launch the following command:
sudo service mysql reset-password
2 - You can also try:
`sudo dpkg-reconfigure mysql-server-x.x`
3 - The third solution is a bit longer but worked for me:
`sudo service mysql stop`
`sudo /usr/bin/mysqld_safe --skip-grant-tables & mysql -h localhost`
You're now connected to mysql bypassing privileges.
USE mysql;
UPDATE USER
SET password = password('<your_new_pass>')
WHERE USER = 'root' AND host = 'localhost';
Your root pass should be resetted now. just quit mysql clt and restart mysql service:
quit
sudo mysqladmin shutdown
sudo service mysql start
来源:https://stackoverflow.com/questions/24061869/bitnami-reset-mysql-root-pwd