moneyslow.com

mysql5.5升级到5.7注意事项

mysql数据库技巧

mysql数据库技巧

采用旧库导出到sql文件,导入新库。遇到的错误:

ERROR 1292 (22007): Incorrect datetime value: '0000-00-00 00:00:00' for column 'time_stamp' at row 1210
Query OK, 0 rows affected, 1 warning (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

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)

参考 https://stackoverflow.com/questions/26480596/how-can-upgrade-mysql-5-5-40-to-mysql-5-7

对sql文件进行时间戳替换:

sed -i.bu 's/'\''0000-00-00 00:00:00'\''/CURRENT_TIMESTAMP/g' fixed_dumo.sql

另外修改mysql配置文件:max_allowed_packet=1024M,原来只有4M

Exit mobile version