1

I'm migrating wordpress websites. Importing the SQLdump from the old server with phpmyadmin returns syntax error's.

Exporting from:

phpMyAdmin SQL Dump
version 4.2.8.1
Serverversie: 5.5.37
PHP-versie: 5.3.29

Importing:

phpMyAdmin
version 4.5.0.2
Serverversie: 5.5.44-MariaDB
PHP-versie: 5.5.30

Syntax error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'about', 'about', '{"title":"about","alias":"about","shortcode":"[rev_slider abou' at line 2

SQl-query. Note, the first 13 tables import without problems

INSERT INTO `d8up675e4c_revslider_sliders` (`id`, `title`, `alias`, `params`) VALUES
(2, 'Full-Screen-1', 'Full-Screen-1', '{"title":"Full-Screen-1","alias":"Full-Screen-1","shortcode":"[rev_slider Full-Screen-1]","source_type":"gallery","post_types":"post","post_category":"category_41","post_sortby":"ID","posts_sort_direction":"DESC","max_slider_posts":"30","excerpt_limit":"55","slider_template_id":"","posts_list":"","slider_type":"fullscreen","fullscreen_offset_container":"","fullscreen_min_height":"","full_screen_align_force":"off","auto_height":"on","force_full_width":"on","responsitive_w1":"940","responsitive_sw1":"770","responsitive_w2":"780","responsitive_sw2":"500","responsitive_w3":"510","responsitive_sw3":"310","responsitive_w4":"0","responsitive_sw4":"0","responsitive_w5":"0","responsitive_sw5":"0","responsitive_w6":"0","responsitive_sw6":"0","width":"1160","height":"1000","delay":"5000","shuffle":"off","lazy_load":"off","use_wpml":"off","stop_slider":"off","stop_after_loops":0,"stop_at_slide":2,"load_googlefont":"false","google_font":["<link href=\\\\''http:\\/\\/fonts.googleapis.com\\/css?family=PT+Sans+Narrow:400,700\\\\'' rel=\\\\''stylesheet\\\\'' type=\\\\''text\\/css\\\\''>"],"position":"center","margin_top":0,"margin_bottom":0,"margin_left":0,"margin_right":0,"shadow_type":"0","show_timerbar":"hide","padding":0,"background_color":"#000000","background_dotted_overlay":"none","show_background_image":"false","background_image":"http:\\/\\/domain.com\\/wp-content\\/","bg_fit":"normal","bg_repeat":"repeat","bg_position":"center top","touchenabled":"on","stop_on_hover":"off","navigaion_type":"bullet","navigation_arrows":"solo","navigation_style":"round","navigaion_always_on":"false","hide_thumbs":200,"navigaion_align_hor":"center","navigaion_align_vert":"bottom","navigaion_offset_hor":"0","navigaion_offset_vert":20,"leftarrow_align_hor":"left","leftarrow_align_vert":"center","leftarrow_offset_hor":20,"leftarrow_offset_vert":0,"rightarrow_align_hor":"right","rightarrow_align_vert":"center","rightarrow_offset_hor":20,"rightarrow_offset_vert":0,"thumb_width":100,"thumb_height":50,"thumb_amount":5,"hide_slider_under":0,"hide_defined_layers_under":0,"hide_all_layers_under":0,"hide_thumbs_under_resolution":0,"start_with_slide":"1","first_transition_type":"fade","first_transition_duration":300,"first_transition_slot_amount":7,"reset_transitions":"","reset_transition_duration":0,"0":"Execute settings on all slides","jquery_noconflict":"on","js_to_body":"false","output_type":"none","template":"false"}'),

Tested the following.

Test 1. Tried other DB dumps (from old server), but they also return syntax errors.

Test 2. Command line mysqldump old server, Command line mysql import new server. This works without errors. But when I then try with phpmyadmin (new server) 'export/clear db/import' I get the same errors?

Test 3. Clearing the params value:

INSERT INTO `d8up675e4c_revslider_sliders` (`id`, `title`, `alias`, `params`) VALUES
(2, 'Full-Screen-1', 'Full-Screen-1', '{}'),
(3, 'about', 'about', '{}'),
(4, 'our-story', 'our-story', '{}'),
(5, 'Screens', 'screens', '{}');

Now all CREATE TABLE and INSERT INTO complete without error's. But I get the following syntax error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ALTER TABLE `d8up675e4c_commentmeta`
  ADD PRIMARY KEY (`meta_id`),
  ADD KEY `c' at line 133

SQL-query

INSERT INTO `d8up675e4c_wpsl_stores` (`wpsl_id`, `store`, `address`, `address2`, `city`, `state`, `zip`, `country`, `country_iso`, `lat`, `lng`, `description`, `phone`, `fax`, `url`, `email`, `hours`, `thumb_id`, `active`) VALUES
(1, 'Shoes shop | Office', 'street 181', '', 'demo city', 'Noord-Brabant', '1111 TM', 'Nederland', 'NL', 51.675339, 4.995821, '', '', '', 'www.domain.com', '[email protected]', '', 3065, 1),
(5, 'April Fashion & Shoes', 'street 1', '', 'VALKENS[...]

Error ALTER TABLE

ALTER TABLE `d8up675e4c_commentmeta`
  ADD PRIMARY KEY (`meta_id`),
  ADD KEY `comment_id` (`comment_id`),
  ADD KEY `meta_key` (`meta_key`(191));

To be extra clear, these are syntax errors when I use phpmyadmin (on the new server) to 'export/clear db/import'.... I used the command line to import the SQL file from the old server.

Tried many different phpmyadmin export settings on the old server, but every time I get the same errors on the new server.

When I export/import websites that are created on that server it works without problems. This is the same for the old server..

No idea what to test anymore, i can't find the solution..

Clearly it has something to do with the different MySQl or phpmyadmin versions. How to resolve that?

Regards, Bjorn

4
  • 1
    “When I export/import websites that are created on that server it works without problems. This is the same for the old server.” – So, create a test table with a minimal data structure and a few records on both servers, export structure and content, and see if you can import each on the other server. If not, see what the differences in the produced SQL statements are.
    – CBroe
    Nov 16, 2015 at 18:50
  • 1
    You're dumping a MySQL database and importing it into MariaDB; they claim it's a drop-in replacement for MySQL, but apparently not. Can you use a proper mysql version on the new server?
    – Kenney
    Nov 16, 2015 at 18:53
  • The MariaDB error seems to suggest that there is a slightly different way to declare the table. Have you looked at the docs?
    – Shawn
    Nov 16, 2015 at 18:55
  • Thanks for your answers! See my answer.. @CBroe, most tables import without problems also a test table -- Kenney, it's prepacked by my VPS provider. -- Shawn, that's the real problem.. MySQL error reports need some work.. damn, I find them mindblowing confusing to be honest, not clear at all.. It had nothing to do with how it's declared or CHARSET.....
    – Bjorn
    Nov 17, 2015 at 1:49

1 Answer 1

2

Found the problem...

After hours off testing I found that the following value is not accepted by the MariaDB:

\\''

Only in a few DB dumps I find this, around 10 occurrences in each dump, mainly inside url's.. Some plugins on the old server have saved their settings with \\'' inside it.

Example that fails on import with syntax error

(618, 'wpdm_login_msg', '<a href=\\''http://domain.com/wp-login.php\\'' >Please login to download</a>', 'yes'),

Notice the \\'' inside the url, replacing them with " fixes all import problems.

3
  • You are testing on MariaDB 5.5.44 but the following works on MariaDB 10.0.21: INSERT INTO t1(c1) VALUES ('<a href=\\''domain.com/wp-login.php\\'' >Please login to download</a>') Nov 17, 2015 at 20:26
  • @MarcDelisle Thanks for your comment, i'll look into upgrading MariaDB.
    – Bjorn
    Nov 18, 2015 at 10:03
  • That was exactly what i was looking for, replacing \\'' with " solved my problem.thank you m8.
    – ThanosDi
    Sep 9, 2016 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.