场景:
系统版本:CentOS 6.4 MySQL版本: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] ~]# 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‘
解决办法:
[[email protected] ~]# vim /etc/my.cnf [mysqld] max_allowed_packet = 500M [mysqldump] quick max_allowed_packet = 500M
[[email protected] ~]# service mysqld restart
再次执行恢复现场操作 [[email protected] ~]# 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;
时间: 2024-10-25 15:16:14