来自mysqldump mysql 5.6

时间:2017-04-03 13:33:13

标签: mysql mariadb

我有一个运行服务器的mysqldump mysql Ver 14.14 Distrib 5.6.35, for Linux (x86_64) using EditLine wrapper centos 6 我正在尝试将其导入到运行mariadb mysql Ver 15.1 Distrib 10.1.22-MariaDB, for Linux (x86_64) using readline 5.1的服务器 那就是运行Centos7

我不断收到类似ERROR 1064 (42000) at line 4908: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '),('5051888098585',2512,131872,359,'Pending','completed','0','1','2016-03-15 17' at line 1

的语法错误

行号显示为随机,如果我删除表并再次开始还原,它可能会在该行之前或之后的某个点再次失败。有时候它几乎可以达到目的。认为不变的是该行始终是一个大插入查询。

这里的类似问题并不能解决我的问题。 我已完全重建服务器,更改了多个mysqldump设置和my.cnf设置,没有任何变化。

目前my.cnf

    [mysqld]
bind-address = ::
skip_name_resolve
local-infile=0
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd



max_allowed_packet =  1G
max_connections = 600
thread_cache_size = 16
query_cache_size = 64M
tmp_table_size= 512M
max_heap_table_size= 512M
wait_timeout=60

#Innodb Settings
innodb_file_per_table=1
innodb_buffer_pool_size = 25G
innodb_log_file_size = 2048M
innodb_flush_log_at_trx_commit = 0
innodb_file_format = Barracuda
innodb_flush_neighbors = 0

#Log

log-error =/var/log/error.log
tmpdir = /dev/shm

我已经为导入和转储尝试了几十个不同的设置没有工作。这些是最新的: 对于转储

mysqldump -u admin -p`cat /etc/psa/.psa.shadow` --master-data=2 db_name --default-character-set=utf8 -c -Q  --result-file=dump.sql

用于导入

mysql -uadmin -p`cat /etc/psa/.psa.shadow` db_name < dump.sql

1 个答案:

答案 0 :(得分:1)

如果您不覆盖它,mysqldump会生成大量INSERT语句,一次处理大量行。由于INSERT行的长度,恢复似乎可能出现问题。

创建转储文件时,请尝试在mysqldump上使用the --net_buffer_length=8192 option。它将生成更短的INSERT语句。您的转储文件会更长,恢复时间会更长,但实际上可能会完成。

如果这不起作用,并且您有时间,请尝试the --skip-opt option跳过所有优化。

请参阅:How to deal with enormous line lengths created by mysqldump

相关问题