登录mysql数据库,出现如下报错
mysql> show databases;
ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist
看百度上统一的方法都是让执行mysql_upgrade -u root -p
结果验证不行,后来按照如下方式得以恢复:
mysql> create user 'mysql.infoschema'@'localhost' IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.10 sec)
mysql> SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
+---------------------------------------+
| query |
+---------------------------------------+
| User: 'root'@'%'; |
| User: 'test'@'%'; |
| User: 'mysql.infoschema'@'localhost'; |
+---------------------------------------+
3 rows in set (0.00 sec)
mysql> show databases;
ERROR 1356 (HY000): View 'information_schema.SCHEMATA' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
mysql> grant select on *.* TO 'mysql.infoschema'@'localhost';
Query OK, 0 rows affected, 1 warning (0.09 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
image.png
网友评论