[root@mysql ~]# mysqldump -uroot -p db_shop >/opt/db_shop.sql
Enter password:
mysqldump: Couldn't execute 'SHOW VARIABLES LIKE 'gtid\_mode'': Table 'performance_schema.session_variables' doesn't exist (1146)
原因:这是mysql服务器由5.5升级到5.7版本导致的根本原因所在。
[root@mysql ~]# mysql_upgrade -uroot -p --force #更新
Enter password:
Checking server version.
Running queries to upgrade MySQL server.
mysql_upgrade: (non fatal) [ERROR] 1728: Cannot load from mysql.proc. The table is probably corrupted
mysql_upgrade: (non fatal) [ERROR] 1545: Failed to open mysql.event
Checking system database.
mysql.columns_priv OK
mysql.db OK
mysql.engine_cost OK
mysql.event OK
mysql.func OK
mysql.general_log OK
mysql.gtid_executed OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.host OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.ndb_binlog_index OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.server_cost OK
mysql.servers OK
mysql.slave_master_info OK
mysql.slave_relay_log_info OK
mysql.slave_worker_info OK
mysql.slow_log OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.user OK
Upgrading the sys schema.
Checking databases.
company.tb_worker OK
db_shop.category OK
db_shop.comment OK
db_shop.goods OK
db_shop.new_goods OK
db_shop.orders OK
db_shop.reply OK
db_shop.tb_worker OK
db_shop.test_goods OK
sky9899.student OK
sky9899.test OK
student.tb_demo OK
sys.sys_config OK
test.company OK
wordpress.wp_commentmeta OK
wordpress.wp_comments
error : Table rebuild required. Please do "ALTER TABLE `wp_comments` FORCE" or dump/reload to fix it!
wordpress.wp_links
error : Table rebuild required. Please do "ALTER TABLE `wp_links` FORCE" or dump/reload to fix it!
wordpress.wp_options OK
wordpress.wp_postmeta OK
wordpress.wp_posts
error : Table rebuild required. Please do "ALTER TABLE `wp_posts` FORCE" or dump/reload to fix it!
wordpress.wp_term_relationships OK
wordpress.wp_term_taxonomy OK
wordpress.wp_termmeta OK
wordpress.wp_terms OK
wordpress.wp_usermeta OK
wordpress.wp_users
error : Table rebuild required. Please do "ALTER TABLE `wp_users` FORCE" or dump/reload to fix it!
Repairing tables
`wordpress`.`wp_comments`
Running : ALTER TABLE `wordpress`.`wp_comments` FORCE
status : OK
`wordpress`.`wp_links`
Running : ALTER TABLE `wordpress`.`wp_links` FORCE
status : OK
`wordpress`.`wp_posts`
Running : ALTER TABLE `wordpress`.`wp_posts` FORCE
status : OK
`wordpress`.`wp_users`
Running : ALTER TABLE `wordpress`.`wp_users` FORCE
status : OK
Upgrade process completed successfully.
Checking if update is needed.
[root@mysql ~]# systemctl restart mysqld #重新启动
[root@mysql ~]# mysqldump -uroot -p db_shop >/opt/db_shop.sql #数据库备份
Enter password:
[root@mysql ~]# ll /opt/
总用量 12
-rw-r--r--. 1 root root 777 10月 1 21:35 bak.sql
-rw-r--r--. 1 root root 7381 10月 30 19:14 db_shop.sql
drwxrwxrwx. 3 root root 63 10月 18 2021 test
[root@mysql ~]# mysql -uroot -p db_shop</opt/db_shop.sql #数据库恢复
Enter password:
使用mysqldump进行数据库备份实战遇到的问题
原创
©著作权归作者所有:来自51CTO博客作者Sky9899的原创作品,请联系作者获取转载授权,否则将追究法律责任
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Centos使用教程
&nbs
Centos使用教程 Linux VMware-workstation CentOS VMware