Skip to main content

MySQL - Cannot use select on user table

ERROR 1356 (HY000): View 'mysql.user' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them

Looks like database is corrupted. Try the following workaround:

1. Insert missing privileges:

Code:

INSERT INTO `tables_priv` (`Host`, `Db`, `User`, `Table_name`, `Grantor`, `Timestamp`, `Table_priv`, `Column_priv`) VALUES ('localhost','mysql','mariadb.sys','global_priv','root@localhost','0000-00-00 00:00:00','Select,Delete','');

2. Restart MariaDB to apply security changes:

systemctl restart mariadb

3. Verify that select works now:

mysql
select * from user;