如何解决MySQL 5.7 Access denied for user 'root'@'localhost' (using password YES)问题?
来源:互联网 发布:got it get it gotcha 编辑:程序博客网 时间:2024/06/15 16:17
欢迎转载,转载请注明出处,谢谢~(作者:喝酒不骑马 Colton_Null)
from CSDN
最近,在CentOS 6.8上使用MySQL时,无法登录数据库,并提示Access denied for user ‘root’@’localhost’ (using password:YES)
经过查阅大量资料,现总结一下可用的解决方法
1.首先关闭MySQL服务
[root@localhost /]# service mysqld stop
2.安全启动MySQL(跳过密码验证)
[root@localhost /]# /usr/bin/mysqld_safe --skip-grant-tables
这时候会报
mysqld_safe Logging to '/var/lib/mysql/iZ23dq2wm0jZ.err'.mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
我用SecureCRT连接的Linux,到这时候就卡住了,ctrl + c也不能退出。后来找到解决方法:卡住时,在用SecureCRT开启一个新的连接到系统上继续操作就可以了。
3.登录MySQL
[root@localhost /]# mysql -u root
4.更改密码
mysql> grant all privileges on *.* to 'root'@'localhost' identified by '123465' with grant option;
其中’root’@’localhost’ 是用户名
第二个’123465’是新密码
如果此处报错The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
则说明没有写入权限,这时候就要关闭数据库只读属性
mysql> set global read_only=0;// 关掉数据库的只读属性mysql>flush privileges;// 刷新配置
之后,再执行修改密码操作
最后,可以再将属性设置回初始状态
mysql> set global read_only=1;// 关掉数据库的只读属性mysql>flush privileges;// 刷新配置
5.重启数据库
[root@localhost /]# service mysqld restart
这时候,就可以用刚才设置的新密码123465登录数据库了。问题解决。
阅读全文
0 0
- 如何解决MySQL 5.7 Access denied for user 'root'@'localhost' (using password YES)问题?
- 解决MySQL #1045 - Access denied for user 'root'@'localhost' (using password: YES) 的问题
- 解决'Access denied for user 'root'@'localhost' (using password: YES)'
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- MySql Access denied for user 'root'@'localhost' (using password: YES)
- mysql access denied for user'root'@'localhost' using password yes
- mysql Access denied for user 'root'@'localhost' (using password: YES)
- mysql:Access denied for user 'root'@'localhost' (using password:YES)
- MySQL:Access denied for user 'root'@'localhost' (using password:YES)
- 解决mysql的错误-access denied for user 'root'@'localhost'(using password:YES) for MACOS
- mysql 错误解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- 解决ubuntu下mysql的'Access denied for user 'root'@'localhost' (using password: YES)'
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- 解决MySql 数据库 提示:1045 access denied for user 'root'@'localhost' using password yes
- 使用视图
- 百练_2718:晶晶赴约会
- 常用nodejs 模块集合。
- POJ 1442 Black Box (Treap)
- Epoll服务器
- 如何解决MySQL 5.7 Access denied for user 'root'@'localhost' (using password YES)问题?
- 对this的解读
- MySQL"十宗罪"
- 自定义Ant
- 怎样委婉的拒酒敬酒
- 设计模式——模板方法模式( Template Method Pattern)
- 端口号调研、URG和PSH、及TCP的计时器
- eclipse报错Resource is out of sync with the file system的解决方法
- 逻辑学 随笔 (始于正方法而终于负方法)