一、问题起因:
在修改了MySQL8.0.35的用户表mysql.user中的root用户口令后(authentication_string 字段值),退出mysql再进入后,使用 show databases/show tables,就出现一下错误:
mysql> show databases;
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema’@‘localhost’) does not exist
mysql> use mysql
Database changed
mysql> show tables;
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema’@‘localhost’) does not exist
*mysql> show databases;
ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
mysql> use mysql
Database changed
mysql> show tables;
ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist*
二、解决办法:
总体办法就是给 mysql.infoschema 用户添加权限。
MySQL8.0 之后,不支持使用 grant 时隐式地创建用户,必须先创建用户,再授权。代码如下:
mysql> create user 'mysql.infoschema'@'%' identified by '密码';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on *.* to 'mysql.infoschema'@'%';
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)
在使用show databases/ show tables,就正常了。
2093

被折叠的 条评论
为什么被折叠?



