Resolve the MySQL: datetime (0) null default null error
Remove the database from mysql5 7 is exported as SQL in mysql5 When importing on 5, there will be an error of datetime (0) null default null. The main reason for the error is mysql5 7 and mysql5 Datetime and timestamp of 5 are incompatible, mysql5 7. The exported format is datetime (0) and mysql5 5, the syntax is not recognized
Solution:
1) Change datetime(0) to datetime, or timestamp(0) to timestamp in the export statement
2) Keep database version consistent
be careful
When datetime is set to CURRENT_TIMESTAMP by default, the length of CURRENT_TIMESTAMP cannot be specified as 0 as well.
datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0)
Correct grammar
datetime NULL DEFAULT CURRENT_TIMESTAMP
Read More:
- Mybatis Error setting non null for parameter #15 with JdbcType null Could not set parameters for
- [MySQL] mysql 5.5 and 5.6 timestamp default default value CURRENT_TIMESTAMP problem
- Front end error: exceptionmessage: null [How to Solve]
- [Solved]ERROR 1067 (42000): Invalid default value for ‘end_time‘ Mysql
- [Solved] MySQL5.6.44 [Err] 1067 – Invalid default value for create_date settlement programme
- Cause: java.sql.SQLException: ORA-01407: Unable to update (“MESIRJ”.”TMMIC01″.”RDEL”) is NULL
- How to Solve mysql [Err] 1067-Invalid default value for
- Mysql ERROR 1067: Invalid default value for ‘date’ [How to Solve]
- mysql workbench Error Code: 1046. No database selected Select the default DB to be used by doubl
- MYSQL Create TIMESTAMP and Save Error: ERROR 1067 (42000): Invalid default value for ‘last_updated_on’
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- [Solved] Django configures MySQL Error: NameError: name ”_MySQL ‘is not defined
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query