Importing wordpress content into phpmyadmin - mysql

I am trying to import one site into Wordpress multisite using phpmyadmin. I have tested on another single site and code imports. I change the wp_ to wp_g22_ and try importing into multi site and get this error:
SQL query:
INSERT INTO wp_g22_options (option_id, option_name, option_value, autoload) VALUES (252433, '_transient_jm_cats_d27300020302d47e080e7e962d68d506', 'a:47:{i:0;O:7:"WP_Term":12:{s:7:"term_id";i:398;s:4:"name";s:13:"Accommodation";s:4:"slug";s:13:"accommodation";s:10:"term_group";i:0;s:16:"term_taxonomy_id";i:418;s:8:"taxonomy";s:20:"job_listing_category";s:11:"description";s:248:"Whatever your budget, find accommodation in Herefordshire, Worcestershire, Gloucestershire, Monmouthshire, Shropshire & Powys. Our Guide2 covers hotels, B&Bs, self-catering, camping, glamping, farmhouses and more.\r\n\r\n ";s:6:"parent";i:0;s:5:"count";i:124;s:6:"filter";s:3:"raw";s:9:"term_type";s:1:"0";s:14:"term_font_icon";s:1:"0";}i:1;O:7:"WP_Term":12:{s:7:"term_id";i:437;s:4:"name";s:10:"Activities";s:4:"slug";s:10:"activities";s:10:"term_group";i:0;s:16:"term_taxonomy_id";i:457;s:8:"taxonomy";s:20:"job_listing_category";s:11:"description";s:418:"The ultimate guide[...]
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 ''a:47:{i:0;O:7:"WP_Term":12:{s:7:"term_id";i:398;s:4:"name";s:13:"Accommodation"' at line 2

Related

I can't read a database on mysql because of wrong syntax in the database name, but the database reads on other platforms like DBmaria

Hi please I am new to mysql and I'd love to know how to access a database with the name 'c-factory'. It seems mysql does not read it because of the '-' sign. I've been able to load it on dbmaria but I don't seem to be able to do it with mysql
SELECT * FROM c-factory
Error Code: 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 '-factory' at line 4 0.000 sec```

SQL syntax error when importing WordPress Database file

I'm trying to move my wordpress site to a new server. I exported my old database to a .zip .sql file using phpMyAdmin
When I try to import the database file on my new server I get this error:
Error
SQL query:
INSERT INTO wp_options VALUES (186159, '_transient_wc_var_prices_575', '{"f9e544f77b7eac7add281ef28ca5559f":{"price":{"6508":"180.00","6507":"180.00","6506":"180.00","6505":"180.00","6509":"180.00","6510":"180.00","6514":"180.00","6513":"180.00","6512":"180.00","6511":"180.00","6504":"180.00","6503":"180.00","6497":"180.00","6496":"180.00","6495":"180.00","6494":"180.00","6498":"180.00","6499":"180.00","6502":"180.00","6501":"180.00","6500":"180.00","6515":"180.00","6516":"180.00","6531":"180.00","6530":"180.00","6529":"180.00","6528":"180.00","6532":"180.00","6533":"180.00","6537":"180.00","6536":"180.00","6535":"180.00","6534":"180.00","6527":"180.00","6526":"180.00","6520":"180.00","6519":"180.00","6518":"180.00","6517":"180.00","6521":"180.00","6522":"180.00","6525":"180.00","6524":"180.00","6523":"180.00","6493":"180.00","6492":"180.00","6463":"180.00","6462":"180.00","6461":"180.00","6460":"180.00","6464":"180.00","6465":"180.00","6469":"180.00","6468":"180.00","6467":"180.00",[...]
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 ''{"f9e544f77b7eac7add281ef28ca5559f":{"price":{"6508":"180.00","6507":"180.00","' at line 1
I've exported and imported many WordPress sites before and never had this happen. The WordPress site is using WooCommerce.
What can be done to fix this?
This looks like an escaping problem, so you should escape the double quotes in your file.
Try to add this as the last value:
REPLACE(#Data.pluginText, '"', '\"')
So your file should look like:
INSERT INTO wp_options VALUES (186159, '_transient_wc_var_prices_575', '{"f9e544f77b7eac7add281ef28ca5559f":{"price":{"6508":"180.00","6507":"180.00","6506":"180.00","6505":"180.00","6509":"180.00","6510":"180.00","6514":"180.00","6513":"180.00","6512":"180.00","6511":"180.00","6504":"180.00","6503":"180.00","6497":"180.00","6496":"180.00","6495":"180.00","6494":"180.00","6498":"180.00","6499":"180.00","6502":"180.00","6501":"180.00","6500":"180.00","6515":"180.00","6516":"180.00","6531":"180.00","6530":"180.00","6529":"180.00","6528":"180.00","6532":"180.00","6533":"180.00","6537":"180.00","6536":"180.00","6535":"180.00","6534":"180.00","6527":"180.00","6526":"180.00","6520":"180.00","6519":"180.00","6518":"180.00","6517":"180.00","6521":"180.00","6522":"180.00","6525":"180.00","6524":"180.00","6523":"180.00","6493":"180.00","6492":"180.00","6463":"180.00","6462":"180.00","6461":"180.00","6460":"180.00","6464":"180.00","6465":"180.00","6469":"180.00","6468":"180.00","6467":"180.00", REPLACE(#Data.pluginText, '"', '\"') );

Mysql syntax errors on import

I need some help with mysql errors keep popping up. Some time ago I could easily export (mainly WordPress) databases from my localhost and import these (via phpmyadmin import) on the webserver to push my websites live. Since a few days I keep getting different mysql error while importing these databases..
I tried a couple of things, changing charactersets, collate settings, ... Nothing seems to work.
I'm not a DB guy, so maybe this is something easy, but I can't seem to figure it out on my own..
Local (xampp on mac)
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.6.26 - Source distribution
Protocolversie: 10
Gebruiker: root#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Webserver
Databaseserver
--------------
Server: Localhost via UNIX socket
Servertype: MySQL
Serverversie: 5.5.31 - MySQL Community Server (GPL)
Protocolversie: 10
Gebruiker: t2c_projects#localhost
Karakterset van server: UTF-8 Unicode (utf8)
Can someone please help me out? I can give all the info needed, don't know which are relevant.. So anyone need additional info please let me know.
Any help is welcome!
Update1:
Errors I'm getting
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
This error is from a database in development, I tried a fresh installation db import and then I'm getting this:
#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 'CREATE TABLE `wp_termmeta` ( `meta_id` bigint(20) UNSIGNED NOT NULL, `term_i' at line 11
I keep getting different syntax errors, I allready tried manually fixing these but they just keep me changing stuff so I'm trying to fix this core issue..
I have a suspicion it has something to do with mysql versions or character sets..
Update2:
So I tried fixing the first (mixed html) error, and after I removed all \' by ", I get new errors (83 errors):
#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 '2016-03-29 10:21:45', '0000-00-00 00:00:00', ' ', '', '', 'draft', 'closed', 'cl' at line 5
It simply seems that your SQL statements are mixed with HTML at some point
#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 ''<div class="rss-widget"><ul><li><a class=\'rsswidget\' href=\'https://wordpress' at line 9
If you believe that it is not the case (e.g. you insert html in rows), please add the full queries to your post, but the issue seems pretty obvious :)
Maybe that some copy/paste manipulation error led to that state.
Without checking the full statement that causes the error, can't say more at the moment..

Parameterize MySQL workbench statements: How to define variables

I'm trying to parameterize a set of frequently used queries in my workbench.
This works:
select * from providers where id='112233';
This
WbVarDef var1=112233;
select * from providers where id='$[var1]';
gives error
Error Code: 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 'from providers where id='112233'' at line 1
My reference was this.
Just to be clear, these are in the MySQL workbench and not a workbench script file or a mysql script file.
In MySQL, syntax for setting variable is below.
SET #var1 = '112233';
and using the variable would be as below.
select * from providers where id=#var1;
Check out MySQL documentation for more information Link to MySQL Documentation
Based on your tag mysql-workbench, I find it simply to be a case where the referenced documentation and use is not relevant to what you are using.
Back up the hierarchy from your link to this http://www.sql-workbench.net/
and you will read:
Please note that SQL Workbench/J has no relation to the product MySQL
Workbench which is maintained and owned by Oracle. If you
are looking for MySQL Workbench support please contact Oracle.

#1064 error in importing database php mysql localhost

I have backup of my live site's database. I want to run it on localhost. I tried to import the back up database that I craeted in phpmyadmin/localhost. But I am getting error something like this:
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 '
"http://www.w' at line 1
Can Any one help me....
This doesn't look like an SQL file, but as Krister Andersson suggested, you should post a few lines so we can see exactly what you are dealing with. How did you create the backup? What file type does it claim to be (is there an extension on the file)?