首页 > 数据库技术 > 详细

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'

时间:2019-06-17 13:53:05      阅读:106      评论:0      收藏:0      [点我收藏+]

在处理这个问题(https://www.cnblogs.com/abclife/p/11038660.html)的时候,开发同学在最后修改视图的definer的时候又遇到了以下的报错信息:

ERROR 1044 (42000): Access denied for user ‘root‘@‘localhost‘ to database ‘information_schema‘

 

数据库版本是:mysql 5.7.25。让他执行以下操作:

>select user();
>select current_user() from dual;
>select host,user from mysql.user where user=‘root‘;

>show grants for root@‘localhost‘;
>show grants for root@‘%‘;

>select * from mysql.user where user=‘root‘;

  

反馈说用户和权限都没啥问题,然后再次让其把执行报错的现象截图发过来:

root@localhost:information_schema 11:16:24>alter definer=`root`@`%` view <view_name> as select  ...
ERROR 1044 (42000): Access denied for user ‘root‘@‘localhost‘ to database ‘information_schema‘

 

可以看到,它是在information_schema数据库下执行,切换到视图真正所在的数据库再次执行命令就可以正确执行了。 

 

 因为information_schema是一个虚拟的数据库,里面的表其实都是视图。其实在导入数据的时候,也没有必要将information_schema导一遍 。 

 

ERROR 1044 (42000): Access denied for user 'root'@'localhost' to database 'information_schema'

原文:https://www.cnblogs.com/abclife/p/11038750.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!