標籤:mysql mysqldump source
情境:
系統版本:CentOS 6.4MySQL版本:5.5.35-log Source distribution邏輯備份命令:mysqldump還原資料命令:source
條件:
備份檔案[[email protected] ~]# ll -d /tmp/cloudTest.sql -rw-r--r-- 1 root root 1575809806 2月 28 09:04 /tmp/cloudTest.sql
恢複現場:
[[email protected] ~]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.5.35-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 = 0mysql> 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‘
解決辦法:
[[email protected] ~]# vim /etc/my.cnf[mysqld]max_allowed_packet = 500M[mysqldump]quickmax_allowed_packet = 500M
[[email protected] ~]# service mysqld restart
再次執行恢複現場操作[[email protected] ~]# mysqlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3Server version: 5.5.35-log Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.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 = 0mysql> source /tmp/cloudTest.sql;
本文出自 “鄭彥生” 部落格,請務必保留此出處http://467754239.blog.51cto.com/4878013/1615870
MySQL 5.5 資料還原遇的棘手問題