ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL为test 1)delete from user where user is NULL 2)update user set user=‘test‘ where user is NULL.意外的情况: 如果上述方法没有效果,依然出现空用户,则可以利用图形化用户client删除.
在重装了CentOS后,发觉Mysql一直不好用。
# mysqladmin create dbname 命令老是返回mysqladmin: connect to server at ’localhost’ failed
# mysql -u root@localhost
>create database dbname;
也同样返回错误ERROR 1045 (28000): Access denied for user ’root’@’localhost’ (using password: NO)
# mysql -u root -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)’
现在终于被我找到了解决方法,如下(请先测试方法三,谢谢!):
方法一:
# /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>
mysql>
方法二:
直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:
# mysql -udebian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>
mysql>
方法三:
这种方法我没有进行过测试,因为我的root用户默认密码已经被我修改过了,那位有空测试一下,把结果告诉我,谢谢!
# mysql -uroot -p
Enter password: <输入/etc/mysql/debian.cnf文件中[client]节提供的密码>
至此,困惑多时的问题解决了!
上一篇:如何设置提高.降低Word.Excel宏安全性的问题
栏 目:office激活
本文标题:ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
本文地址:https://fushidao.cc/wangzhanyunying/13797.html
您可能感兴趣的文章
- 05-12怎么激活office016,office2016激活密钥
- 05-12怎么查询office激活时间,office激活时间怎么查
- 05-12怎么激活电脑自带office,电脑自带office如何激活
- 05-12office许可掉了怎么激活,office密钥激活失败怎么办
- 05-12正版office怎么算激活,office正版激活方法
- 05-12平板office怎么免费激活,office免费激活方法
- 05-12怎么去重新激活office,office激活失败怎么办
- 05-12kms怎么取消激活office,office激活失败怎么办
- 05-12新电脑怎么office激活?office激活失败怎么办
- 05-12office2020怎么激活?office2020激活失败怎么办
阅读排行
- 1怎么激活office016,office2016激活密钥
- 2怎么查询office激活时间,office激活时间怎么查
- 3怎么激活电脑自带office,电脑自带office如何激活
- 4office许可掉了怎么激活,office密钥激活失败怎么办
- 5正版office怎么算激活,office正版激活方法
- 6平板office怎么免费激活,office免费激活方法
- 7怎么去重新激活office,office激活失败怎么办
- 8kms怎么取消激活office,office激活失败怎么办
- 9新电脑怎么office激活?office激活失败怎么办
- 10office2020怎么激活?office2020激活失败怎么办
推荐教程
- 07-012025最新office2010永久激活码免费分享,附office 2010激活工具
- 07-092025年最新office365激活码 office365永久激活密钥key分享
- 07-01怎么免费获取2025最新office2016专业增强版永久激活密钥/序列号
- 11-30正版office2021永久激活密钥
- 07-30Office2019 产品激活密钥(100%永久激活)
- 11-25怎么激活office2019最新版?office 2019激活秘钥+激活工具推荐
- 07-052025最新Office2019激活密钥,Office2019产品密钥分享
- 11-22office怎么免费永久激活 office产品密钥永久激活码
- 06-25office2021年最新永久有效正版激活密钥免费分享
- 11-25office2010 产品密钥 永久密钥最新分享
