1. 程式人生 > >MySQL導入數據提示Lost connection to MySQL server

MySQL導入數據提示Lost connection to MySQL server

數據 .sql -m k8s character cte skip pac code

數據庫版本為Mariadb 5.5,使用K8S進行管理
mysql -uroot -p xxxx < xxxxx.sql
在本地提示
ERROR 2013 (HY000) at line 1320: Lost connection to MySQL server during query

這個是因為mysql的max_allow_packet默認的只有16MB,我們在mysql的配置文件中添加一行
max_allowed_packet=100M

或者修改pod下的args參數
args: ["--character-set-server=utf8mb4", "--collation-server=utf8mb4_unicode_ci", "--event_scheduler=ON", "--max_allowed_packet=100M", "--skip-name-resolve"]

添加一個"--max_allowed_packet=100M" 即可

MySQL導入數據提示Lost connection to MySQL server