Error (1142) SELECT command denied on session_variables table with mysqldump

大兔子大兔子 提交于 2019-12-20 17:30:55

问题


When I try to run mysqldump -u dump -p myschema > dumpfile.sql I get this error message:

mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': SELECT command denied to user 'dump'@'localhost' for table 'session_variables' (1142)

I found something about adding --set-gtid-purged=OFF for a similar error. But I'm not running the MySQL 5.6 version of mysqldump on an older MySQL database. However, when I try it, I get a new, yet similar, error:

mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'ndbinfo\_version'': SELECT command denied to user 'dump'@'localhost' for table 'session_variables' (1142)

I'm not sure why the user needs access to the session_variables table, which I presume is information_schema.SESSION_VARIABLES, since this SO post said that the following permissions were sufficient.​

Grants for dump@localhost

 GRANT USAGE ON *.* TO 'dump'@'localhost'
 GRANT SELECT, LOCK TABLES ON mysql.* TO 'dump'@'localhost'
 GRANT SELECT, LOCK TABLES, SHOW VIEW, EVENT, TRIGGER ON myschema.* TO  'dump'@'localhost'

What's going on and how do I make mysqldump work?

Here's some of my system info

MySQL Version

Server version: 5.7.8-rc MySQL Community Server (GPL)

mysqldump version

Ver 10.13 Distrib 5.7.8-rc, for Linux (x86_64)


回答1:


This is a result of mysql server upgrade. Run

# mysql_upgrade -u root -p --force
# systemctl restart mysqld


来源:https://stackoverflow.com/questions/33270703/error-1142-select-command-denied-on-session-variables-table-with-mysqldump

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!