MySQL 执行SQL脚本 报ERROR 1231 (42000)的解决办法

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'

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'

解决方法:

 

mysql> set max_allowed_packet=2000M;  --只对当前会话生效

mysql> source ./xxxx.sql;

永久生效:修改my.cnf

添加:

[mysqld]
max_allowed_packet = 2000M


本文出自海阔中文网 https://www.moneyslow.com

京ICP备11047313号-19 彩虹岛电子书