ERROR 1045 (28000): Access denied for user
来源:互联网 发布:用户行为数据分析 编辑:程序博客网 时间:2024/06/05 18:03
错误描述: 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.意外的情况: 如果
错误描述: 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]节提供的密码>
至此,困惑多时的问题解决了!
- ERROR 1045 (28000): Access denied for user
- Tech : ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost'
- Mysql: ERROR 1045 (28000): Access denied for user
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- MySQL Error 1045(28000) Access Denied for user 'root'@'localhost'
- mysql笔记: ERROR 1045 (28000): Access denied for user
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- mysql ERROR 1045 (28000): Access denied for user
- Mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- mysql ERROR 1045 (28000): Access denied for user解决方法
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost'
- Mysql ERROR 1045 (28000): Access denied for user '
- ERROR 1045 (28000): Access denied for user'root'@'localhost'
- 【windows】 mysql ERROR 1045 (28000): Access denied for user解决方法
- [SGU]138. Games of Chess
- 身份证号码规则
- Android开发之适配器ListView
- 仿射变换(Affine Transform)
- 编译OpenCV2.4.3中的OCL模块
- ERROR 1045 (28000): Access denied for user
- Project Euler problem 28
- Spring中的Bean实现的创建三种方式
- ORACLE SQL语句优化技术分析
- readline wrap
- 测试类,梯形,圆,三角形
- HDU 4394 bfs
- 爱情天梯!真爱都是伟大的!
- Spring特点中关于DI,IOC及AOP的理解