MySQL报错ERROR 1044 (42000)

文章目录

    • 1. 报错
    • 2. 排查
    • 3. 解决

1. 报错

进入mysql,执行针对库授予对应用户权限,报错:
ERROR 1044 (42000): Access denied for user ‘root’@‘192.168.20.33’ to database ‘库名’

2. 排查

登录执行方式是 mysql -h192.168.20.33 -xxxxxx的方式,所以查询发现root在该IP地址并且没有 WITH GRANT OPTION 选项,无法对其他用户授权。

1) mysql > select user,host,grant_priv from mysql.user where user=“root”;
MySQL报错ERROR 1044 (42000)_第1张图片

2) mysql > show grants for root@‘192.168.20.33’;
MySQL报错ERROR 1044 (42000)_第2张图片

3. 解决

mysql > update mysql.user set grant_priv=“Y” where user=“root” and host=“192.168.20.33”;
mysql > flush privileges;
MySQL报错ERROR 1044 (42000)_第3张图片
在这里插入图片描述

你可能感兴趣的:(数据库,自动运维,mysql,数据库)