I used Import Wizard to import a csv file (encoding UTF-8, I tried UTF-16, etc). However, I got such an error :
ERROR: Import data file: ("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
'élection`,`Région d'élection`,`Profession`,`Permanence`,`Entête 1 P`,`Entete'
at line 1", 1064)
The special characters show correctly.
The MySQL Workbench import wizard seems like it fails to escape apostrophes in column names. I tested this with MySQL Workbench 8.0.29 and I got a similar error as you did.
This is reported as a bug here: https://bugs.mysql.com/bug.php?id=95700, but the bug is not yet fixed. They suggest a workaround of using JSON input files instead of CSV, but that doesn't help you if you must import CSV files.
Besides this bug, it is well known that the MySQL Workbench import wizard is [terrible for performance][4]. Even if you can get it to work by changing your column names, you won't be happy.
I recommend using the command-line tool mysqlimport or the equivalent SQL statement LOAD DATA. It's not a GUI, but it works with special column names, and it is orders of magnitude faster.
So I've downloaded a huge database from the internet and I'm trying to import it using mysql -t < data_dump.sql
After running this, I get the following output:
ERROR 1193 (HY000) at line 5: Unknown system variable 'statement_timeout'
I tried doing this with another SQL file previously, and it worked just fine. Sorry if this is a really easy problem to fix, I'm not very experienced with SQL.
Hello you have this error because you are trying to import the .sql file from an other database engine.If you want to use the .sql file you need to convert the dump file from postgre (syntax-format ) to mysql (syntax-format).
For more help check here
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, '"', '\"') );
This is may be foolish question. But i cant find the answer of this problem anywhere.
i have a .sql3 and a .csv file i want do import functionality in my mysql workbench using any of these file.
right now i dont have any tables and shemas in my mysql
when i am importing my demo.csv or demo.sql3 files in my workbench its showing an error like
ERROR 1064 (42000) at line 1: 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 'SQLite format 3' at line 1
I am on ubuntu
can anyone help me out from this problem
thanks in advance
For reading csv data into MySQL LOAD DATA is probably the best way to go. There's a plugin in MySQL WOrkbench for importing CSV data but it requires an existing result set.
BULK INSERT krissmall
FROM 'C:\Users\Administrator\Downloads\misskrisdata_small.csv'
WITH (FIELDTERMINATOR = ',', ROWTERMINATOR = '\n')
ERROR 1064 (42000): 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 'BULK
INSERT krissmall FROM 'C:\Users\Administrator\Downloads\misskrisdata_small.' at
line 1
Can someone please tell me where went wrong? Or some other reasons behind this. I stared at this query for a long time, and looked it up a lot but I cannot find where it is wrong.
I'm curious where you looked up BULK INSERT since that doesn't seem to be supported by MySQL at all. Maybe you're reading MS SQL documentation and confusing the two.
What you want is LOAD DATA INFILE which can parse CSV.
You tagged phpmyadmin which leads me to believe that you are trying to execute this query from a remote server (possibly a web host). The remote server can't connect to your local drive. You must import through phpMyAdmin or upload the file you wish to import to a directory that phpMyAdmin can see.