2017-04-03 80 views
1

我有一個服務器上運行 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隨機語法錯誤5.6

一個mysqldump的

我經常收到一個語法錯誤,這樣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 

我已經試過幾十個爲進口和轉儲沒有什麼不同的設置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 
+0

多少內存.. –

+0

@RickJames 32G。 –

回答

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

+0

謝謝。我使用--net_buffer_length = 8192來導出轉儲,並導入時沒有問題。 –