ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
程序员文章站
2023-01-10 11:09:15
错误描述: Mysql中添加用户之后可能出现登录时提示ERROR 1045 (28000): Access denied for user的错误.删除user.user中值为NULL的,或更新NULL为test 1)delete from user where user i... 09-03-10...
错误描述: 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
>create database dbname;
也同样返回错误error 1045 (28000): access denied for user (using password: no)
# mysql -u root -p
enter password:
error 1045 (28000): access denied for user (using password: no)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password ’newpassword’
enter password:
mysqladmin: connect to server at ’localhost’ failed
error: ’access denied for user (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]节提供的密码>
至此,困惑多时的问题解决了!
在重装了centos后,发觉mysql一直不好用。
# mysqladmin create dbname 命令老是返回mysqladmin: connect to server at ’localhost’ failed
# mysql -u
>create database dbname;
也同样返回错误error 1045 (28000): access denied for user (using password: no)
# mysql -u root -p
enter password:
error 1045 (28000): access denied for user (using password: no)
使用网上介绍的方法修改root用户的密码:
# mysqladmin -uroot -p password ’newpassword’
enter password:
mysqladmin: connect to server at ’localhost’ failed
error: ’access denied for user (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]节提供的密码>
至此,困惑多时的问题解决了!
上一篇: JS中实现浅拷贝和深拷贝的代码详解
下一篇: 五种食物帮你高效抗皱 越吃越年轻
推荐阅读
-
MySQL密码正确却无法本地登录-1045 Access denied for user 'root'@'localhost' (using password:YES
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决
-
ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using passwor
-
java访问数据库被拒绝,不能连接数据库ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
-
Linux连接mysql报错:Access denied for user ‘root’@‘localhost’(using password: YES)的解决方法
-
ERROR 1045 (28000): Access denied for user ''root''@''localhost'' (using password: YES)实用解决方案
-
ERROR 1045 (28000): Access denied for user root@localhost (using password: NO)
-
连接本地数据库出现:1045 - Access denied for user 'root'@localhost'(using pass
-
Access denied for user 'root'@'localhost' (using password:YES) Mysql5.7
-
ERROR 1045: Access denied for user: root@localhost (Using password: NO)