ITPub博客

首页 > Linux操作系统 > Linux操作系统 > ERROR 1045 (28000): Access denied for user 'root'@'localhost'

ERROR 1045 (28000): Access denied for user 'root'@'localhost'

原创 Linux操作系统 作者:zzhen163 时间:2010-12-09 17:15:53 0 删除 编辑
错误提示:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解决方法:1

方法一:
# /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 -uroot -p
Enter password: <输入新设的密码newpassword>

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/223555/viewspace-681425/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-09-27

  • 博文量
    35
  • 访问量
    71273