Access Denied for user 'root'@'localhost' (Using password:NO)解决方法

  • Error 1045(28000) Access Denied for user 'root'@'localhost' (Using password:NO)解决方法:

     
    # /etc/init.d/mysql stop (或killall mysqld)
    # 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 -uroot -p
    Enter password: <输入新设的密码newpassword>

    重启服务器

猜你喜欢

转载自thierry-xing.iteye.com/blog/1933216