暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

mysql8 ERROR 1449处理

原创 黄江平 2022-01-20
2183

场景:mysql8.0的数据库执行show databases 报错ERROR 1449 (HY000)The user specified as a definer (‘mysql.infoschema’@‘localhost’) does not exist

1.演示错误:

mysql [localhost:8024] {msandbox} ((none)) > delete from mysql.user where user=‘mysql.infoschema’;
Query OK, 1 row affected (0.01 sec)

mysql [localhost:8024] {msandbox} ((none)) > flush privilges;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘privilges’ at line 1
mysql [localhost:8024] {msandbox} ((none)) > flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql [localhost:8024] {msandbox} ((none)) > select user,host from mysql.user;
±--------------±----------+
| user | host |
±--------------±----------+
| R_CUSTOM | % |
| R_DO_IT_ALL | % |
| R_READ_ONLY | % |
| R_READ_WRITE | % |
| R_REPLICATION | % |
| msandbox | 127.% |
| msandbox_ro | 127.% |
| msandbox_rw | 127.% |
| rsandbox | 127.% |
| msandbox | localhost |
| msandbox_ro | localhost |
| msandbox_rw | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
±--------------±----------+
15 rows in set (0.00 sec)

mysql [localhost:8024] {msandbox} ((none)) > show databases;
ERROR 1449 (HY000): The user specified as a definer (‘mysql.infoschema’@‘localhost’) does not exist
mysql [localhost:8024] {msandbox} ((none)) > exit

因是手动删除了系统用户,一种方法是再创建用户,授权可以解决。
另一种是重新升级一下数据字典。
2.升级数据字典
image.png

image.png

3.小结
数据字典不一致的,有可能是mysql5.7升级到8.0未完成。8.0会自动升级数据字典,不像原来版本,要手动执行mysql_upgrade.

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论