问题
Can anyone show or tell me whats wrong in this block? I can not see it.
#--------------------------------------------------------
#
# Table structure for table 'user'
#
DROP TABLE IF EXISTS __TABLE_PREFIX__user;
CREATE TABLE __TABLE_PREFIX__user (
username varchar(32) DEFAULT '' NOT NULL,
level int(11) DEFAULT '0' NOT NULL,
password varchar(41) DEFAULT '' NOT NULL,
first_name varchar(64) DEFAULT '' NOT NULL,
last_name varchar(64) DEFAULT '' NOT NULL,
email_address varchar(63) DEFAULT '' NOT NULL,
time_stamp timestamp(14),
status enum('INACTIVE','ACTIVE') DEFAULT 'ACTIVE' NOT NULL,
uid int(11) NOT NULL auto_increment,
session varchar(32),
PRIMARY KEY (username),
KEY uid (uid)
);
Database said:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(14), status enum('INACTIVE','ACTIVE') DEFAULT 'ACTIVE' NOT NULL, uid int(11' at line 8
回答1:
The TIMESTAMP(n) syntax denoting a length is deprecated and no longer supported in MySQL 5.5. Instead use:
time_stamp timestamp,
From the MySQL TIMESTAMP documentation
In older versions of MySQL (prior to 4.1), the properties of the TIMESTAMP data type differed significantly in several ways from what is described in this section (see the MySQL 3.23, 4.0, 4.1 Reference Manual for details); these include syntax extensions which are deprecated in MySQL 5.1, and no longer supported in MySQL 5.5. This has implications for performing a dump and restore or replicating between MySQL Server versions. If you are using columns that are defined using the old TIMESTAMP(N) syntax, see Section 2.19.1.2, “Upgrading from MySQL 4.1 to 5.0”, prior to upgrading to MySQL 5.1 or later.
See also the upgrade guide.
来源:https://stackoverflow.com/questions/8128330/sql-error-version-5-5-15