[实践OK]mysqldump:Unknown system variable GTID_MODE 原因与解决方法,Table 'performance_schema.session_variables' doesn't exist (1146),

jackxiang 2015-12-19 00:09 | |
背景:升级了一下mysql到最新版本 5.7.9,博客数据没有动,后导出数据备份时出现Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'',加上 --set-gtid-purged=off出现新错误的问题,总之一堆问题,最后还是终于导出了,特别是升级后一定要重启,啥玩意,艹。
实践如下,出现问题:
[root@iZ25dcp92ckZ backup]# mysqldump -uroot -p -ujustwinit_mysql_database > -ujustwinit_mysql_database.cn.sql
Enter password:
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': Table 'performance_schema.session_variables' doesn't exist (1146)




用mysqldump备份时出现下面的出错信息:
mysqldump:Couldn't execute  ‘SELECT @@GTID_MODE':Unknown system variable 'GTID_MODE' (1193)
造成此错误的原因是因为5.6引入了Global Transaction Identifiers (GTIDs) 。GTIDs可以让主从结构复制的跟踪和比较变得简单。mysqldump会试图查询这个系统变量,但这个变量在5.6之前的版本中不存在,所以产生错误。解决的方法很简单,在mysqldump后加上–set-gtid-purged=OFF命令
如:
mysqldump -h(主机名或ip) -u(用户名) -p(密码) 数据库名 --set-gtid-purged=off >d:/db.sql

From:http://www.rjkfw.com/s_3139.html
___________________________________________________________________

[root@iZ25dcp92ckZ ~]#  mysqldump  --set-gtid-purged=off -uroot -p -ujustwinit_mysql_database > -ujustwinit_mysql_database.cn.sql
Enter password:
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'ndbinfo\_version'': Table 'performance_schema.session_variables' doesn't exist (1146)
解决办法:
[root@iZ25dcp92ckZ ~]# 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
。。。。。。
sys.sys_config                                     OK
temperature.temperature                            OK
temperature.tempsetting                            OK
Upgrade process completed successfully.
Checking if update is needed.

再次导出:
[root@iZ25dcp92ckZ ~]#  mysqldump  --set-gtid-purged=off -uroot -p -ujustwinit_mysql_database > -ujustwinit_mysql_database.cn.sql
Enter password:
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'ndbinfo\_version'': Native table 'performance_schema'.'session_variables' has the wrong structure (1682)

忘记重启了,于是重启下,再次导出,出现新的错:
[root@iZ25dcp92ckZ bin]#  mysqldump  --set-gtid-purged=off -u-ujustwinit_mysql_database_mysql_database -p -ujustwinit_mysql_database_mysql > -ujustwinit_mysql_database.cn.sql
Enter password:
mysqldump: Got error: 1044: Access denied for user '-ujustwinit_mysql_database_mysql'@'localhost' to database '-ujustwinit_mysql_database_mysql' when using LOCK TABLES

用mysqldump备份数据库时出现when using LOCK TABLES_:
--skip-lock-tables
普通用户备份mysql 数据库报错

mysql 无lock tables权限 报Access denied for user 'dbuser'@'localhost' to database 'db' when using LOCK TABLES

主要原因是该用户无lock tables 该权限,处理办法:

1. 给该普通用户赋予lock tables 权限,建议是删除该用户,重新用mysql命令建

2. 加上--skip-lock-tables即可

mysqldump -udbuser -p dbname --skip-lock-tables > dbname.sql


3. 使用root 备份


MySQL无lock tables权限 报Access denied for user when using LOCK TABLES:
http://www.linuxidc.com/Linux/2012-01/51802.htm

mysqldump  --set-gtid-purged=off --skip-lock-tables -u-ujustwinit_mysql_database_mysql_database -p -ujustwinit_mysql_database_mysql > -ujustwinit_mysql_database.cn.sql

成功了:
[root@iZ25dcp92ckZ bin]# mysqldump  --set-gtid-purged=off --skip-lock-tables -uroot -p justwinit_mysql_database  > jackxiang.com.database.bak.perfected.2015.12.29.sql
Enter password:



来自:http://www.amznz.com/error-native-table-performance_schema/


作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/8392/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2015-12-29 23:45
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]