MySQL8遇到的问题记录

问题1:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

问题描述:

[root@loaclhost ~]# mysql -u root

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

[root@loaclhost ~]# mysql -u root  -p

Enter password:

ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

解决办法:

1、修改/etc/my.cnf,不使用密码登录

加上skip-grant-tables,保存

重启mysql :systemctl restart mysqld

2、不用密码登录

3、ALTER USER 'root'@'%' IDENTIFIED BY '123456';

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

输入:flush privileges;

4、再次输入:ALTER USER 'root'@'%' IDENTIFIED BY '123456';

提示:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

(此处参考后面的4、修改简单权限)

5、再次修改密码:ALTER USER 'root'@'%' IDENTIFIED BY '123456';

6、刷新权限
mysql> flush privileges;

7、退出mysql,清除my.cnf的skip-grant-tables后重启mysql
systemctl restart mysqld

最后,再次登录,输入密码可登录

 

 问题2:ERROR 1396 (HY000): Operation ALTER USER failed for 'root'@'%'

解决办法:

按照以下步骤执行:

进入mysql库

use mysql;

刷新权限

mysql> flush privileges;

清空密码

mysql> UPDATE user SET authentication_string="" WHERE user=“root”;

刷新权限

mysql> flush privileges;

设置root的新的密码

mysql>alter user’root’@’%’ IDENTIFIED BY 'test123 ';

刷新权限

mysql> flush privileges;

退出mysql,清除my.cnf的skip-grant-tables后重启mysql

systemctl restart mysqld

问题3:ERROR 1227 (42000): Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation

解决办法:

#给root用户授权

grant system_user on *.* to 'root';

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

宁宁可可

您的鼓励是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值