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.
Related
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.
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)?
ERROR 1064 (42000) at line 33892 in file: 'contarproducts.sql': 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 ''\r\n \r\n
How can I resolve this issue?
Your help will be much appreciated.
1) You have this tagged as MySQL but then you seem to be running MariaDB, those aren't the same thing.
2) If there's an error in your SQL (which is what this is saying) and this SQL file was exported from the database it seems as though copying or moving the file cut it off and it didn't finish copying. If the file doesn't get fully copied and the end of the file looks like SELECT * FRO then that will be a syntax error.
Try re-exporting the file before importing it again.
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.
I want to import several .sql files into database using source command (mysql command line). But when I get this error:
source E:\Progs\Backups\DBs\file01.sql
ERROR:
Unknown command '\P'.
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 'sourc
e E:\Progs' at line 1
....
I used source command to import large files hundreds times but now I can not understand what I'm doing wrong. This is my system(I'm using XAMPP (Basis Package) version 1.7.3 :
Windows 7x64
MySQL 5.1.41 (Community Server) with PBXT engine 1.0.09-rc
Any help would be appreciated.
Thanks!
Edit:
I tried this one, but same error:
source 'E:\Progs\Backups\DBs\file01.sql'
MySQL sees the \P in E:\Progs as a command. Because that command does not exist, it complains.
Forward slashes are understood in many cases. Try:
source E:/Progs/Backups/DBs/file01.sql