Im trying to import the database file of wikipedia (titles only, 163M) from http://dumps.wikimedia.org/enwiki/latest/ with phpMyAdmin (I have a wamp configuration). I already changed the values on php.ini and Im receiving this error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unknown Punctuation String # 1511
Where could be the problem? Do I need to change the coalltion from UTF8 to something else?
Thank you!
#user593712:
Do I need to change the coalltion from UTF8
No, you need to ensure that the database you're importing to is UTF-8. See http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki#Character_set
The error message tells you that, there is an error around line number 1511. Could you please check the contents around that line. Sometimes, single quote "'" should be replaced by "\'" to import into the database.
Related
First of all, I just want to say that I'm new to SQL, so forgive me if I'm being ignorant or something.
I'm working on this project and I need to import data from a text file. My first thought was to use this command:
LOAD DATA LOCAL INFILE '/tmp/test.txt' INTO TABLE names;
Where my text file is test and my table is names.
However, I got this error message:
Error Code: 2. File '\tmp\teste.txt' not found (Errcode: 2 - No such file or directory)
I tried to save this file in the tmp folder but I still got this same error. I was told that maybe the problem is in my.ini (something about the --secure-file-priv) but I just can't find my MySQL folder in C:\ProgramData. Apparently, that is where my.ini is supposed to be. So, any ideas of what is going on?
By the way, I'm not confusing C:\Program Files and C:\ProgramData
P.S: I use Windows 10 and MySQL Workbench 6.3 CE.
Alright pals, the problem is solved. I honestly don't know how I managed to find the problem but I did and as expected, it was a silly one. The correct statement would be:
load data infile 'c:\\wamp\\tmp\\test.txt' into table names;
I got confused with all that slashes thing, because for directories you use \ or /. So my mistake was doing this:
load data infile 'c:\wamp\tmp\test.txt' into table names;
Using only one backslash instead of two, which is wrong. Finally, I just needed to put my text file in the tmp folder and use the appropriate backslashes (no need for LOCAL). Thanks for the help!
I have problem with mysql database. I can't import a database from my friend.
I need some help.
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
ERROR:
Unexpected beginning of statement. (near "phpMyAdmin" at position 0)
Unrecognized statement type. (near "SQL" at position 11)
#1064 - Something is wrong in your syntax obok 'phpMyAdmin SQL Dump
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"' w linii 1
There´s nothing wrong with you syntax, but probably with your file:
most likely the file was edited and the text-editor (of course Windows notepad.exe) was too clever and added a BOM on saving.
Remove the first 3 bytes (HEX: EF BB BF), save the file without it (either use a hex editor or use PSPad and switch format to UNIX), and the importer should have no problem anymore.
The BOM fools the importer, the first - gets eaten and the importer no longer recognizes the first comment as such.
Wikipedia about BOM:
File comparison (w/o BOM)
I encountered exactly the same problem. Apparently, you use a version of phpMyAdmin which has bugs in the import module (in my case it was phpMyAdmin 4.5.5.1 packaged in Wamp 3.0.4). More precisely, it interprets comments (valid syntax with space after --) as SQL code. This is the case at the beginning of a dump created by phpMyAdmin: it typically starts with
-- phpMyAdmin SQL Dump
which explains your error message.
The import module of phpMyAdmin 4.5.5.1 was not able to parse escaped single quotes either (see https://github.com/phpmyadmin/phpmyadmin/issues/11721).
There are many possible workarounds to this problem:
Update phpMyAdmin
Use another tool to import your DB dump, for example MySQL Command Line or MySQL workbench
Less advisable: execute the contents of the .sql file as a query in your current version of phpMyAdmin (it has fewer bugs)
Less advisable: strip all comments from your .sql file
windows notepad and other editor, change encoding of file.
for change it to utf-8 open your file with "notepad++" and use Encoding menu then select UTF-8
now save your file
I'm trying to import a database form mysql to weka, but the problem is that even after the database is loaded and displayed, when I click ok so I can start working whit the database, the message "unknown data type: INT" appears. I've tried modifying the DatabaseUtil.props file but nothing seems to work, so I really preacite if someone could tell me how to solve this issue once for all.
Thanks
You can either remove the comment from the int datatype lines in the prop file, or take the mysql prop file included, add:
INT=5
Since 5 is the identifier for int types, then rename the mysql props file to DatabaseUtil.props
Put just, without semicolons or others characters
INT=5
I am trying to convert a set of CSV files into a HSQLDB database. My first attempt was to fire up DatabaseManagerSwing and execute the following code:
* *DSV_COL_SPLITTER = ;
\mq /home/michael/workspaces/rds-surveyor/lt/it/NAMES.DAT
commit;
Which gets rejected with the error message:
java.sql.SQLSyntaxErrorException: unexpected token: *
In order to get at least some response from HSQLDB, I tried removing the first line, but this gives just a slightly different error:
java.sql.SQLSyntaxErrorException: unexpected token:
I then came across sqltool, and after overcoming its various pitfalls (you need the sqltool JAR, as well as the hsqldb JAR of the same version in the same path or somewhere in your classpath) I ran the full code here. The first line got processed as expected, but the \mq command fails with a similar error:
SEVERE Cause: SQLSyntaxErrorException: unknown token:
The file I am trying to import looks like this (first few lines shown):
CID;LID;NID;NAME;NCOMMENT
25;1;165;Europa;
25;1;167;Italia;
25;1;169;Abruzzo;
25;1;171;Chieti;
25;1;173;Passo Di Lanciano;
25;1;175;Valico Castiglione Messer Marino;
25;1;177;Valico Della Forchetta;
What's going wrong here?
The command you are trying to execute belongs to SqlTool, which is a separate command line client for HSQLDB and is in a separate jar in the zip package. The guide is here: http://hsqldb.org/doc/2.0/util-guide/sqltool-chapt.html
In DatabaseManagerSwing, you can use a different method of creating TEXT tables for CSV files. http://hsqldb.org/doc/2.0/guide/texttables-chapt.html
I have now abandoned the import path for other reasons and am instead doing the CSV import in my application.
While working with the CREATE TABLE statements, which I built from the first row of the CSV file copied in, I got the same error message for my SQL code. Closer analysis of the SQL file with a hex editor revealed a byte-order marker (BOM) at the beginning of the pasted column name. After eliminating the BOM, the SQL code would run without any further nagging.
I remember that some of the files I am trying to import start with a BOM (which has given me quite a headache earlier) – therefore I assume the BOM was the "unknown token" HSQLDB was complaining about all the time. Since the BOM is a nonprinting character, it explains why no token was shown in the error message.
Lesson learned: An "invalid token" error with no character shown in the message is likely due to a BOM, control character or other nonprinting stuff in the offending input. A hex editor will reveal that.
I've been ramming my face against this sql error for about 45 minutes, and I have a feeling it's going to be something silly.
I'm trying to load a .txt file into my database, which is on a server elsewhere. I'm using putty on windows 7.
The sql call I am using is the following:
LOAD DATA LOCAL INFILE "C:/Users/Sam/Desktop/students_data.txt" INTO TABLE students;
The response I get is ERROR 2 (HYOOO): File 'C:/Users/Sam/Desktop/students_data.txt' not found (Errcode:2)
If anyone could shed some light on this that'd be extravagant. I already tried switching the / to \ and using single quotes, etc., but nothing seems to work. The file path is copied by shift+clicking the actual file and pasting it.
I have found a solution. First delete the word LOCAL from the sql statement. Second - place your file into MySQL DATA folder usually - bin/mysql/msql5.5.8/data/and your DB with which you are working. It worked for me. You might want to check your MAX_FILE upload number in php.ini file if file is large.
Removing the word LOCAL seemed to work for me; try it out!
Try to type path as C:\\mydir\\myfile.csv i.e. use \\ instead of \
I had this problem too, then I read this:
The file name must be given as a literal string. On Windows, specify
backslashes in path names as forward slashes or doubled backslashes
(from http://dev.mysql.com/doc/refman/5.1/en/load-data.html)
I did use the LOCAL keyword, but escaped the file path like this: str_replace('\\','/',$file), then it worked like a charm!
Had this too and solved it by using cmd.exe and found that the filename was mistakenly in the form filename.txt.txt and fixed it.
just replace "\" by "/" as the path directory before the filename.txt in (""). it will be better if u just keep the file in mysql data folder and do the thing i mentioned above.it will definitely work.
Sorry my previous answer is wrong.
In my case, I connect to a proxy, not the real physical mysql instance, so of course it could not get my local file.
To solve this, figure out the true physical mysql instance IP, connect it directly. You need help from the DBA.
LOAD DATA LOCAL INFILE 'C:\\cygwin\\home\\jml58z\\e_npv\\Fn_awk2010.mysql' INTO TABLE mydata
with the double \ it worked