标签:mysql
解决方法:
1、停止mysql进程
# /etc/init.d/mysql stop
执行后输出:
Stopping MySQL database server: mysqld.
2、安全模式启动mysql,跳过授权表
# mysqld_safe --skip-grant-tables &
执行后输出:
[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started
3、新窗口打开终端连接到mysql
# mysql -u root
4、重置密码
mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User=‘root‘;
mysql> flush privileges;
mysql> quit
5、停止mysql服务
# /etc/init.d/mysql stop
6、重启mysql
# /etc/init.d/mysql start
# mysql -u root -p
标签:mysql
原文地址:http://smileyf.blog.51cto.com/11112339/1758206