$ STR = "create table test (
Id int (11) not null auto_increment primary key,
Name varchar (255) not null,
IP varchar (255) not null,
Ly text not null,
Addtime datetime not null default '2017-00-00 00:00:00 ',
) Type = InnoDB ;";
Version: MySQL 5.0
----------------------------------------------
The preceding SQL statement took me three hours to find out where it was wrong.
This gives me a deeper understanding of the syntax of SQL statements.
Summary:
1. in MySQL, uppercase and lowercase letters are not differentiated.
2. Do you have a semicolon at the end.
Type = InnoDB; "; and type = InnoDB"; are correct.
3. Define the last security segment and do not need ",". (that is, this problem has caused me a headache for three hours)
Error: addtime datetime not null default '2017-00-00 00:00:00 ',
Correct: addtime datetime not null default '2017-00-00 00:00:00'