msyql重设密码

来源:互联网 发布:矩阵乘法分配律 编辑:程序博客网 时间:2024/05/16 17:35
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

于是重改密码!

#sudo /etc/init.d/mysql stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart
# mysql -u root -p
Enter password: 

mysql>

搞定!



来自:http://apps.hi.baidu.com/share/detail/24851967