MySQL – Error 1064 During Import

migrationMySQL

When I try to import my database on the production server, I get:

SQL запрос:

CREATE TABLE `articles` (
  `id_art` int(11) NOT NULL AUTO_INCREMENT,
  `id_section` int(11) NOT NULL,
  `id_ct` bigint(20) NOT NULL DEFAULT '0',
  `fesid` int(11) NOT NULL DEFAULT '0',
  `date_art` datetime(6) DEFAULT NULL,
  `title_art` varchar(250) NOT NULL,
  `meta_art` longtext,
  `short_art` text NOT NULL,
  `full_art` longtext NOT NULL,
  `foto_art` varchar(100) DEFAULT NULL,
  `foto_art_text` text,
  `coordinates_art` longtext,
  `hot` tinyint(1) NOT NULL,
  PRIMARY KEY (`id_art`),
  KEY `articles_fesid_c163d690_uniq` (`fesid`),
  KEY `articles_id_ct_af67450c_uniq` (`id_ct`),
  KEY `articles_id_section_8f87bacd_uniq` (`id_section`)
) ENGINE=MyISAM AUTO_INCREMENT=4060 DEFAULT CHARSET=cp1251;

Ответ MySQL: Документация

#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 '(6) DEFAULT NULL,
  `title_art` varchar(250) NOT NULL,
  `meta_art` longtext,
  ' at line 6

What causing this and do I fix that?

I tried to import with Phpmyadmin and by mysql -u user -p basename < filename.sql

I made export with mysqldump

Best Answer

This line seems to be causing the problem

`date_art` datetime(6) DEFAULT NULL,

This works

`date_art` datetime DEFAULT NULL,

Is the version of the database you exported from the same as you are importing to?

https://stackoverflow.com/questions/2572209/why-doesnt-mysql-support-millisecond-microsecond-precision

http://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html