【MySQL導入sql腳本報錯】
Got a packet bigger than 'max_allowed_packet' bytes
【原因】
導入的資料大于系統的限制的最大包大小。
【解決方案】
插入的資料太大了,需要更改MySQL的預設配置。
1、檢視配置檔案路徑
[[email protected] ~]# mysql --help | grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
2、修改配置檔案
[[email protected] ~]# vi /etc/my.cnf
在[mysqld]下加入這一行:
max_allowed_packet = 500M
儲存退出
3、重新開機資料庫
/etc/init.d/mysqld restart
再次導入即可。