200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > mysql登录报错 Access denied for user ‘root‘@‘localhost‘ (using password: YES)

mysql登录报错 Access denied for user ‘root‘@‘localhost‘ (using password: YES)

时间:2022-09-05 21:17:54

相关推荐

mysql登录报错 Access denied for user ‘root‘@‘localhost‘ (using password: YES)

MySQL登录时报错

提示拒绝访问 Access denied

出现access denied的原因有如下可能:

1)MySQL服务没启动:检查服务器状态

systemctl status mysqld

MySQL服务运行正常,若MySQL已经没有启动,重启MySQL服务器:systemctl restart mysqld

2)用户的端口号或者IP导致:若用户的端口号与IP(3306/3307)不一致,打开my.ini文件进行编辑。全部编辑替换为: port=X

3)root用户的密码错误:解决方案

vim /etc/f文件

在[mysqld]后添加skip-grant-tables(登录时跳过权限检查)

重启MySQL服务:systemctl restart mysqld

重启完成 输入mysql –uroot –p;直接回车

登录过后修改root密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassWord1.';

如果出现:ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

刷新 flush privileges;

再次修改:ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPassWord1.';

退出:exit

再把f的skip-grant-tables删除或者注释掉

重启MySQL:systemctl restart mysqld

重新用新密码登录成功

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。