標籤:pop .net erro follow pen blog tags http start
8693044
匯入資料庫的時候 SQLyog 報錯了
Error Code: 2006 – MySQL server has gone away
搜了下,說是max_allowed_packet (MySQL的一個參數)設定的值不夠大。
那我改下就行了 嘿嘿
In Windows:
In the MySQL server installation directory,
in my.ini file, add the following line under [mysqld] in SERVER SECTION.
max_allowed_packet = 16M
In Linux:
Copy the my-xxx.cnf file from /usr/share/mysql to /etc as my.cnf
xxx can be small, medium, large, huge … depending on the requirement.
$ cp /usr/share/mysql/my-xxx.cnf /etc/my.cnf
In the my.cnf file, change the default
max_allowed_packet = 1M
to
max_allowed_packet = 16M
Save the file and restart MySQL server.
今天匯入.sql檔案時出現了Error Code: 2006 – MySQL server has gone away錯誤,原來是匯入的sql檔案大於系統預設的max_allowed_packet的值,查了很多修改設定檔的,但是沒有找到my.cfg檔案,修改其他檔案不管用,所以直接使用sql語句來修改:
SET GLOBAL max_allowed_packet=67108864;
這個挺好使的,改完之後不用重啟服務,直接好使了
SQLyog恢複資料庫報錯解決方案【Error Code: 2006 - MySQL server has gone away】