MySQL 5.5 数据还原遇的棘手问题
场景:
系统版本:CentOS 6.4 MySQL版本:5.5.35-log Source distribution 逻辑备份命令:mysqldump 还原数据命令:source
条件:
备份文件 [root@localhost ~]# ll -d /tmp/cloudTest.sql -rw-r--r-- 1 root root 1575809806 2月 28 09:04 /tmp/cloudTest.sql
恢复现场:
[root@localhost ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.35-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> create database cloudTest; mysql> user cloudTest; mysql> set session sql_log_bin = 0 mysql> source /tmp/cloudTest.sql; ......(执行时长25分钟左右) ERROR 1231 (42000): Variable ‘time_zone‘ can‘t be set to the value of ‘NULL‘ ERROR 1231 (42000): Variable ‘sql_mode‘ can‘t be set to the value of ‘NULL‘ ERROR 1231 (42000): Variable ‘foreign_key_checks‘ can‘t be set to the value of ‘NULL‘ ERROR 1231 (42000): Variable ‘unique_checks‘ can‘t be set to the value of ‘NULL‘ ERROR 1231 (42000): Variable ‘character_set_client‘ can‘t be set to the value of ‘NULL‘ Query OK, 0 rows affected (0.00 sec) ERROR 1231 (42000): Variable ‘collation_connection‘ can‘t be set to the value of ‘NULL‘ ERROR 1231 (42000): Variable ‘sql_notes‘ can‘t be set to the value of ‘NULL‘
解决办法:
[root@localhost ~]# vim /etc/my.cnf [mysqld] max_allowed_packet = 500M [mysqldump] quick max_allowed_packet = 500M
[root@localhost ~]# service mysqld restart
再次执行恢复现场操作 [root@localhost ~]# mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 3 Server version: 5.5.35-log Source distribution Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. mysql> create database cloudTest; mysql> user cloudTest; mysql> set session sql_log_bin = 0 mysql> source /tmp/cloudTest.sql;
本文出自 “郑彦生” 博客,请务必保留此出处http://467754239.blog.51cto.com/4878013/1615870
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。