安全模式进入数据库
打开命令终端依次输入命令:
1。 cd /usr/local/mysql/bin
2。 sudo su
3。 sh-3.2#./mysqld_safe –skip-grant-tables &
打开另外一个命令终端输入命令:
1。 mysql -u -root 就可以进入数据库了。
修改密码
1。 UPDATE mysql.user SET authentication_string = PASSWORD(‘MyNewPass’)
WHERE User = ‘root’ AND Host = ‘localhost’;
2。 FLUSH PRIVILEGES;
3。 /usr/local/mysql/share/mysql.server start
4。 mysql -u root -p
- Your password has expired. To log in you must change it using a client that supports expired passwords.
1。 /usr/local/mysql/bin/mysqladmin -u root -p password
2。Enter password:
New password:
Confirm new password: