centos7.5 导出整个数据库报错
问题:
[root@db01 ~]# mysqldump -uroot -pBgx123.com --all-databases --single-transaction --master-data=1 --flush-logs >/root/db_$(date +%F)_all.sql
mysqldump: [Warning] Using a password on the command line interface can be insecure.
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': Native table 'performance_schema'.'session_variables' has the wrong structure (1682)
原因:
需要升级mysql
解决方法:
[root@db01 ~]# mysql_upgrade -u root -pBgx123.com --force #升级mysql
[root@db01 ~]# systemctl restart mysqld #注意需要重启mysqld
[root@db01 ~]# mysqldump -uroot -pBgx123.com --all-databases --single-transaction --master-data=1 --set-gtid-purged=OFF --flush-logs >/root/db_$(date +%F)_all.sql #成功
mysqldump: [Warning] Using a password on the command line interface can be insecure.
[root@db01 ~]# ll
-rw-r--r-- 1 root root 529693 Mar 6 19:51 db_2019-03-06_all.sql