我有一个mysqldump来自运行mysql Ver 14.14 Distrib 5.6.35, for Linux (x86_64) using EditLine wrapper centos 6的服务器,我试图将它导入到运行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的语法错误
行号看起来是随机的,如果我删除表并再次启动还原,它可能会在该行之前或之后的某个点再次失败。有时候它几乎要结束了。认为这是常量的是,行始终是一个大的insert查询。
这里类似的问题不能解决我的问题。我已经完全重建了服务器,更改了多个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我已经为导入和转储尝试了几十种不同的设置,worked.These是最新的:对于转储
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发布于 2017-04-03 13:57:59
如果不重写它,mysqldump将生成大量的INSERT语句,这些语句一次处理许多行。由于INSERT行的长度,您的还原可能出现了问题。
在创建转储文件时,尝试在mysqldump上使用mysqldump。它将生成更短的INSERT语句。转储文件将更长,恢复时间也会更长,但它实际上可能会运行到完成。
如果这不起作用,而且您有时间,请尝试 option跳过所有优化。
参见:How to deal with enormous line lengths created by mysqldump
https://stackoverflow.com/questions/43186062
复制相似问题