一、数据表有外键
#1.报错信息
[root@dxg-ml mysql-3306.bak]# mysql -P 13306 -u root -p < ./airflow.sql
Enter password:
ERROR 1824 (HY000) at line 18: Failed to open the referenced table 'user'
#2.报错解决
[root@dxg-ml mysql-3306.bak]# cat <(echo "SET FOREIGN_KEY_CHECKS=0;") airflow.sql | mysql -P 13306 -u root -p
Enter password:
您在 /var/spool/mail/root 中有邮件
[root@dxg-ml mysql-3306.bak]#
二、时间字段有默认值
#1.报错信息
[root@dxg-ml mysql-3306.bak]# mysql -P 13306 -u root -p < ./ihg.sql
Enter password:
ERROR 1067 (42000) at line 183: Invalid default value for 'LST_LD_TS_PETRANS'
#2.报错解决
1.在mysql配置文件新增如下配置
[mysqld]
sql_mode=NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO
2.重启服务
[root@dxg-ml mysql-3306.bak]# systemctl restart mysqld.service
3.重新导入数据成功
[root@dxg-ml mysql-3306.bak]# mysql -P 13306 -u root -p < ./ihg.sql
Enter password:
您在 /var/spool/mail/root 中有邮件
[root@dxg-ml mysql-3306.bak]#