linux mysql root密码重置

MySQL安装解决方法:重改密码
先停止 Mysql

# stop mysql

重要:输入下面的代码
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
重置密码:newpassword  这里是你的新密码!!
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
重新加载权限表
mysql> FLUSH PRIVILEGES;

退出mysql
mysql> quit
启动 Mysql
# start mysql

登陆吧!!
# mysql -uroot -p
Enter password:

posted @ 2015-12-31 16:37  sp950622  阅读(164)  评论(0编辑  收藏  举报