user2940591
user2940591

Reputation: 21

how to merge mysql databases? error 1064

I would like to merge two zen-cart databases, but when I copy the difference from one to the other before import I get error 1064

I can import either one by it's self but not together

DROP TABLE IF EXISTS `admin_pages`;
CREATE TABLE IF NOT EXISTS `admin_pages` (
`page_key` varchar(255) NOT NULL DEFAULT '',
`language_key` varchar(255) NOT NULL DEFAULT '',
`main_page` varchar(255) NOT NULL DEFAULT '',
`page_params` varchar(255) NOT NULL DEFAULT '',
`menu_key` varchar(255) NOT NULL DEFAULT '',
`display_on_menu` char(1) NOT NULL DEFAULT 'N',
`sort_order` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `page_key` (`page_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

--
-- Dumping data for table `admin_pages`
--

INSERT INTO `admin_pages` (`page_key`, `language_key`, `main_page`, `page_params`, `menu_key`, `display_on_menu`, `sort_order`) VALUES

--
-- from DB 1
--

'configImageHandler4', 'BOX_TOOLS_IMAGE_HANDLER', 'FILENAME_IMAGE_HANDLER', '', 'tools', 'Y', 14),
'configUltimateSEO', 'SEO_CONFIGURATION_GROUP_TITLE', 'FILENAME_CONFIGURATION', 'gID=31', 'configuration', 'Y', 26);

--
-- from DB 2
--

'configTMMegamenu', 'BOX_CONFIGURATION_TM_MEGAMENU', 'FILENAME_CONFIGURATION', 'gID=38', 'configuration', 'Y', 38),
'configZXSlideshow', 'BOX_CONFIGURATION_ZX_SLIDESHOW', 'FILENAME_CONFIGURATION', 'gID=39', 'configuration', 'Y', 39),
'configTMCustomblock', 'BOX_CONFIGURATION_TM_CUSTOMBLOCK', 'FILENAME_CONFIGURATION', 'gID=53', 'configuration', 'Y', 53);

Error SQL query:

( 'configTMMegamenu', 'BOX_CONFIGURATION_TM_MEGAMENU', 'FILENAME_CONFIGURATION', 'gID=38', 'configuration', 'Y', 38 ), ( 'configZXSlideshow', 'BOX_CONFIGURATION_ZX_SLIDESHOW', 'FILENAME_CONFIGURATION', 'gID=39', 'configuration', 'Y', 39 ), ( 'configTMCustomblock', 'BOX_CONFIGURATION_TM_CUSTOMBLOCK', 'FILENAME_CONFIGURATION', 'gID=53', 'configuration', 'Y', 53 );

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 ''configTMMegamenu', 'BOX_CONFIGURATION_TM_MEGAMENU', 'FILENAME_CONFIGURATION', '' at line 1

Upvotes: 1

Views: 131

Answers (1)

zedfoxus
zedfoxus

Reputation: 37059

Try the following block of CREATE and INSERT. A couple of opening parenthesis were missing and as you detected, semi-colon in one spot had to be replaced with a comma:

CREATE TABLE IF NOT EXISTS `admin_pages` (
`page_key` varchar(255) NOT NULL DEFAULT '',
`language_key` varchar(255) NOT NULL DEFAULT '',
`main_page` varchar(255) NOT NULL DEFAULT '',
`page_params` varchar(255) NOT NULL DEFAULT '',
`menu_key` varchar(255) NOT NULL DEFAULT '',
`display_on_menu` char(1) NOT NULL DEFAULT 'N',
`sort_order` int(11) NOT NULL DEFAULT '0',
UNIQUE KEY `page_key` (`page_key`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `admin_pages` (`page_key`, `language_key`, `main_page`, `page_params`, `menu_key`, `display_on_menu`, `sort_order`) VALUES

--
-- from DB 1
--

('configImageHandler4', 'BOX_TOOLS_IMAGE_HANDLER', 'FILENAME_IMAGE_HANDLER', '', 'tools', 'Y', 14),
('configUltimateSEO', 'SEO_CONFIGURATION_GROUP_TITLE', 'FILENAME_CONFIGURATION', 'gID=31', 'configuration', 'Y', 26),

--
-- from DB 2
--

('configTMMegamenu', 'BOX_CONFIGURATION_TM_MEGAMENU', 'FILENAME_CONFIGURATION', 'gID=38', 'configuration', 'Y', 38),
('configZXSlideshow', 'BOX_CONFIGURATION_ZX_SLIDESHOW', 'FILENAME_CONFIGURATION', 'gID=39', 'configuration', 'Y', 39),
('configTMCustomblock', 'BOX_CONFIGURATION_TM_CUSTOMBLOCK', 'FILENAME_CONFIGURATION', 'gID=53', 'configuration', 'Y', 53);

Example: http://sqlfiddle.com/#!9/058db

Upvotes: 1

Related Questions