Mysql提示 “ Got a packet bigger than 'max_allowed_packet' bytes”
問題描述
遷移伺服器,要把舊伺服器上的mysql資料複製到新伺服器的mysql上。
我先是把舊伺服器的資料庫用mysqldump複製了一份,然後想匯入到新伺服器,用命令匯入,結果提示
ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes ERROR 2006 (HY000): MySQL server has gone away No connection. Trying to reconnect... Connection id: 54350 ERROR 1231 (42000): Variable 'time_zone' can't be set to the value of 'NULL' ERROR 1231 (42000): Variable 'sql_mode' can't be set to the value of 'NULL' ERROR 1231 (42000): Variable 'foreign_key_checks' can't be set to the value of 'NULL' ERROR 1231 (42000): Variable 'unique_checks' can't be set to the value of 'NULL' ERROR 1231 (42000): Variable 'character_set_client' can't be set to the value of 'NULL' Query OK, 0 rows affected (0.00 sec) ERROR 1231 (42000): Variable 'collation_connection' can't be set to the value of 'NULL' ERROR 1231 (42000): Variable 'sql_notes' can't be set to the value of 'NULL'
根據網上說的方案,我在命令列加上--max_allowed_packet=128M
mysql --max_allowed_packet=128M -u user -ppass database < database.sql
結果還是提示 Got a packet bigger than 'max_allowed_packet' bytes
然後我又嘗試用MysqlWorkBench客戶端匯入,還是提示 Got a packet bigger than 'max_allowed_packet' bytes 。
實在太奇怪了,明明這個.sql檔案只有82K啊!
解決方案(感謝@blacktulip提供)
mysql -u root -p -e "set global net_buffer_length=1000000; set global max_allowed_packet=1000000000;"
然後重啟 mysqld, 再正常匯入就可以了……
相關文章
- "Got a packet bigger than 'max_allowed_packet' bytes"錯誤解決辦法Go
- 解決MySQL資料匯入報錯Got a packet bigger than‘max_allowed_packet’bytesMySqlGo
- mysql資料庫匯入sql檔案時提示“Error Code: 1153 - Got a packet bigger than 'max_allowed_packet' bytes”解決辦法MySql資料庫ErrorGo
- MySQ匯出資料包錯Error 2020: Got packet bigger than 'max_allowed_packet'ErrorGo
- MySQL報錯:Packets larger than max_allowed_packet are not allMySql
- Mysql資料庫的max_allowed_packet設定方法MySql資料庫
- 技術分享 | MySQL:max_allowed_packet 影響了什麼?MySql
- max_allowed_packet引起MySQL遷移丟失資料的問題MySql
- 聊聊 MySQL 網路緩衝區、net_buffer_length、max_allowed_packet 那些事MySql
- Pycharm:設定完Anaconda後報錯TypeError: an integer is required (got type bytes)PyCharmErrorUIGo
- python用pyinstaller生成exe時報錯 TypeError: an integer is required (got type bytes)PythonErrorUIGo
- 【MySQL】mysqld got signal 11 案例一則MySqlGo
- MySQL ERROR Got an error reading communication packetsMySqlErrorGo
- Lost connection to MySQL server at 'reading authorization packet'MySqlServer
- MySQL報錯:waiting for initial communication packetMySqlAI
- 【MySQL】Got fatal error 1236原因和解決方法MySqlGoError
- MySQL:Specified key was too long; max key length is 767 bytesMySql
- bit,bytes
- MySQL報錯Slave: received end packet from server, apparent master shutdownMySqlServerAPPAST
- Mysql連線錯誤:Lost connection to Mysql server at 'waiting for initial communication packet'MySqlServerAI
- She Got her ownGo
- MySQL SQL hint 提示MySql
- MySQL Case-max_allowed_packet過小是否會擷取sql文字MySql
- MYSQL CLENT/SERVER資料包傳輸及net packet buffer作用解析MySqlServer
- 【Mysql】Slave_IO_Running: No---Got fatal error 1236 from masterMySqlGoErrorAST
- mysqldump Got error: 1045MySqlGoError
- mysqld got signal 8MySqlGo
- Windows10系統下提示計算機中packet.dll丟失如何解決Windows計算機
- PS/2 packet parser and datapath
- mysql執行報The server time zone value 'Öйú±ê׼ʱ¼ä' is unrecognized or represents more than one tim......MySqlServerZed
- Windows中的程式的Working Set,Private Bytes和Virtual BytesWindows
- Percona MySQL 日誌中出現大量Aborted connection (Got an error reading)MySqlGoError
- mysqldump: Got error: 2002: Can't connect to local MySQL server through.....MySqlGoErrorServer
- DNS: More than just namesDNS
- Why Java is better than .NETJava
- mysqldump Got error 1290MySqlGoError
- PyShark入門(4):packet物件物件
- MySQL修改提示符(prompt)MySql