4

I have been developing an application using MySQL 5.6, now I have to install it on a production server which uses MySQL 5.5. The problem is the backup generated via mysqldump seems to not be backwards compatible.

As I cannot change the MySQL version in any of the machines. I'm looking for a way to export the data with backwards compatibility for 5.5, or a way to import the data from 5.6.

The error I'm having is:

ERROR 1064 (42000) at line 105: 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, is_superuser tinyint(1) NOT NULL, username varchar(30)' at line 4

the problematic code is:

--
-- Table structure for table `auth_user`
--

DROP TABLE IF EXISTS `auth_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `auth_user` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `password` varchar(128) NOT NULL,
  `last_login` datetime(6) DEFAULT NULL,
  `is_superuser` tinyint(1) NOT NULL,
  `username` varchar(30) NOT NULL,
  `first_name` varchar(30) NOT NULL,
  `last_name` varchar(30) NOT NULL,
  `email` varchar(254) NOT NULL,
  `is_staff` tinyint(1) NOT NULL,
  `is_active` tinyint(1) NOT NULL,
  `date_joined` datetime(6) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

The problems seems to be datetime(6), which is not accepted by MySQL 5.5

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
DenJohX
  • 306
  • 1
  • 13

1 Answers1

2

I ended up replacing all appearances of datetime(6) for just datetime in the backup file.

For the time being is working all fine.

DenJohX
  • 306
  • 1
  • 13