首页 > 代码库 > mysql ERROR 1045 (28000): Access denied for user ‘
mysql ERROR 1045 (28000): Access denied for user ‘
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password ‘newpassword‘
Enter password:
mysqladmin: connect to server at ‘localhost‘ failed
error: ‘Access denied for user ‘root‘@‘localhost‘ (using password: YES)‘
现在终于被我找到了解决方法:
Enter password:
ERROR 1045 (28000): Access denied for user ‘root‘@‘localhost‘ (using password: NO)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password ‘newpassword‘
Enter password:
mysqladmin: connect to server at ‘localhost‘ failed
error: ‘Access denied for user ‘root‘@‘localhost‘ (using password: YES)‘
现在终于被我找到了解决方法:
切换到root用户,然后进入mysql 的bin目录后,
root@cps-desktop:/usr/local/mysql/bin# /etc/init.d/mysql stop
root@cps-desktop:/usr/local/mysql/bin# ./mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
root@cps-desktop:/usr/local/mysql/bin# ./mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD(‘newpassword‘) where USER=‘root‘;
mysql> FLUSH PRIVILEGES;
mysql> quit;
最后重启数据库:
root@cps-desktop:/usr/local/mysql/bin# /etc/init.d/mysql restart
root@cps-desktop:/usr/local/mysql/bin# mysql -u root -p
Enter password: <输入新设的密码newpassword>
mysql>
mysql ERROR 1045 (28000): Access denied for user ‘
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。