Search code examples
mysqldatabaseinnodb

Database not importing


Error


##

--

-- Database: verticalned

-- --------------------------------------------------------

-- Table structure for table announcements

CREATE TABLE  `announcements` (
    `id` INT( 10 ) NOT NULL , 
    `description` VARCHAR( 6000 ) DEFAULT NULL  , 
    `links` VARCHAR( 100 ) DEFAULT NULL , 
    `first` TINYINT( 1 ) DEFAULT > NULL , 
    `second` TINYINT( 1 ) DEFAULT NULL , 
    `third` TINYINT( 1 ) DEFAULT NULL , 
    `fourth` TINYINT( 1 ) DEFAULT NULL , 
    `staff` VARCHAR( 22 ) DEFAULT NULL , 
    `time` DATETIME( 2 ) DEFAULT NULL , 
    `subject` VARCHAR( 100 ) DEFAULT NULL
) ENGINE = INNODB DEFAULT CHARSET = latin1;

MySQL said: Documentation

1064 - 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 '(2) DEFAULT NULL, subject varchar(100) DEFAULT NULL ) ENGINE=InnoDB DEFAULT ' at line 20


version



enter image description here


Solution

  • Looks like the mysql version you are using (probably older than 5.6.4) does not accept precision (fractional seconds). You can bypass the issue by replacing ..., time DATETIME(2) DEFAULT NULL ,... with ... , time DATETIME DEFAULT NULL ,....

    However, you should solve the issue by either changing the data type to timestamp or upgrading MySQL server to a version later than 5.6.4