I am extremely new to MySQL and am running it on Windows. I am trying to restore a Database from a dumpfile in MySQL, but I get the following error:
$ >mysql -u root -p -h localhost -D database -o < dump.sql
ERROR: ASCII '\0' appeared in the statement, but this is not allowed unless option --binary-mode is enabled and mysql is run in non-interactive mode. Set --binary-mode to 1 if ASCII '\0' is expected. Query: 'SQLite format 3'.
I tried $ > mysql -u root -p -h localhost -D database --binary-mode -o < dump.sql
but this gave me the following ERROR at line 1: Unknown command '\☻'.
It is a 500 Mb dump file, and when I view its contents using gVIM, all I can see is expressions and data which is not comprehensible. Also when I try to copy contents from the file to post here all I can copy is :SQLite format 3
This kind of seems strange.
Best Answer
The reference to
--binary-mode
(introduced in MySQL 5.6.3) is probably a distraction.It doesn't sound like you're dealing with a mysqldump output file, there. Try the
file
utility.If you don't get the
ASCII text
response, you're dealing with either something that isn't a dump file frommysqldump
at all, or you're dealing with something that's been compressed (with gzip or bzip2, for example), which you'd need to uncompress before piping it intomysql
.If you see
SQLite 3.x database
then you definitely have your answer... it's a raw SQLite database, not a MySQL dump file.Indeed, the first few bytes of a SQLite database are these:
Note that the 16th octet here is 0x00, explaining the
ERROR: ASCII '\0' appeared in the statement...
message in this case. The suggestion that--binary-mode
is appropriate is a false alarm.Windows users: the 'file' utility is a tool from Unix, but the Windows version can be found here.