首页 文章 类别 VISION 关于


Mysqldump:performance_schema.session_variables不存在

升级mysql到5.7之后,在使用mysqldump导出数据库到的时候,出现下列错误:

$ mysqldump -h127.0.0.1 -uroot test_database | mysql -h10.100.100.10 -uroot test_database
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': Table 'performance_schema.session_variables' doesn't exist (1146)

百度无果,最终在Stackoverflow上找到类似的问题: Error (1142) SELECT command denied on session_variables table with mysqldump

执行mysql_upgrade命令,之后重启mysql服务:

$ mysql_upgrade -u root -p --force
Enter password:
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
...
sys.sys_config                                     OK
Upgrade process completed successfully.
Checking if update is needed.
$ mysql.server restart
Shutting down MySQL
. SUCCESS!
Starting MySQL
. SUCCESS!

再次执行mysqldump就可以了。