Reputation: 395
I did a SQL Dump from my MySQL [version 5.6.12] a few days ago now I am trying to import back to the same DB.
The line
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
is not working, it throws a
#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 ') ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1
' error.
I have tripple checked the syntax, and even copped and pasted from one of the other tables that successfully import.
not sure what could be wrong. here is the full SQL: http://pastebin.com/hrBKv7Su.
NOTE: I know there are simlar posts none have helped so far.
Upvotes: 2
Views: 276
Reputation: 270767
When faced with a 1064 error that points to a specific location, look to the character or word right before it. There, you'll find an errant trailing comma in this case.
CREATE TABLE IF NOT EXISTS `item` (
`id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` VARCHAR(11) NOT NULL,
`string` VARCHAR(30) NOT NULL,
`price` DECIMAL(9,2) NOT NULL,
`note` VARCHAR(500) DEFAULT NULL,
`categoryId` SMALLINT(5) UNSIGNED NOT NULL,
`printerId` tinyint(3) NULL DEFAULT NULL,
`hidden` tinyint(1) NOT NULL DEFAULT '0',
`inStock` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
KEY `categoryId` (`categoryId`,`printerId`),
KEY `printerId` (`printerId`),
/* -------------------------^^^ remove that comma */
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
Upvotes: 3