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

We are dealing with this problem( https://www.cnblogs.com/abclife/p/11038660.html )The developer encountered the following error message when modifying the definer of the view at last:

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

 

The database version is MySQL 5.7.25. Ask him to do the following:

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

>show grants for [email protected]'localhost';
>show grants for [email protected]'%';

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

  

The feedback said that there was nothing wrong with the user and the permission, and then asked the user to send the screenshot of the execution error again

[email protected]: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'

 

As you can see, it’s in information_ Schema database, switch to the database where the view is located, and execute the command again to execute correctly

Because of information_ Schema is a virtual database in which all tables are views. In fact, when importing data, there is no need to import information_ Schema.

Similar Posts: