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://www.fushidao.cc/wangzhanyunying/13797.html
您可能感兴趣的文章
- 11-28Office365激活码怎么激活?正版激活码哪里买
- 11-28Office激活密钥怎么用?Office激活密钥永久有效吗
- 11-28office2016激活密钥怎么激活,永久密钥哪里找?
- 11-28Office2010激活码怎么永久激活,Office2010激活码免费获取方法
- 11-27Office怎么激活,Office激活密钥和激活工具怎么用
- 11-27Office激活工具怎么用,office激活工具哪个安全好用?
- 11-26Office激活失败怎么办,Office激活密钥怎么用
- 07-12免费安装激活Office教程详解,如何零成本获得正版办公软件?,office正版激活教程
- 07-12如何准确查询Office软件的激活有效期及具体激活日期?office软件激活时间怎么查
- 07-12非自带Office系统如何合法激活并使用?详细步骤揭秘!Office正版激活教程
阅读排行
- 1Office365激活码怎么激活?正版激活码哪里买
- 2Office激活密钥怎么用?Office激活密钥永久有效吗
- 3office2016激活密钥怎么激活,永久密钥哪里找?
- 4Office2010激活码怎么永久激活,Office2010激活码免费获取方法
- 5Office怎么激活,Office激活密钥和激活工具怎么用
- 6Office激活工具怎么用,office激活工具哪个安全好用?
- 7Office激活失败怎么办,Office激活密钥怎么用
- 8免费安装激活Office教程详解,如何零成本获得正版办公软件?,office正版激活教程
- 9如何准确查询Office软件的激活有效期及具体激活日期?office软件激活时间怎么查
- 10非自带Office系统如何合法激活并使用?详细步骤揭秘!Office正版激活教程
推荐教程
- 07-012025最新office2010永久激活码免费分享,附office 2010激活工具
- 07-092025年最新office365激活码 office365永久激活密钥key分享
- 07-01怎么免费获取2025最新office2016专业增强版永久激活密钥/序列号
- 06-25office2021年最新永久有效正版激活密钥免费分享
- 11-30正版office2021永久激活密钥
- 07-30Office2019 产品激活密钥(100%永久激活)
- 07-052025最新Office2019激活密钥,Office2019产品密钥分享
- 11-25怎么激活office2019最新版?office 2019激活秘钥+激活工具推荐
- 11-22office怎么免费永久激活 office产品密钥永久激活码
- 07-25office专业增强版2021永久激活密钥(附激活教程)
