Reputation: 41
Whenever I try to import a database I keep getting a wall of text and I have no clue what to do with it. I have googled around and everywhere I go says to do the following:
mysqlimport -u USERNAMEHERE -pPASSWORD DATABASENAMEHERE < path/to/dbdump.sql
or
mysql -u USERNAMEHERE -pPASSWORD DATABASENAMEHERE < path/to/dbdump.sql
However when I try to use it all I get is this:
Checklist:
File exists: yes
Username is correct: yes
DB name is correct: yes
Path to file is correct: yes
Password is correct: yes
I can dump the database without a problem but I just cant restore it and it contains some really important information....
EDIT:
Also im using ubuntu 12.04 LTS 64 bit with MYSQL ver 3.7 Distrib 5.5.41, for debian-linux-gnu (x86_64)
Upvotes: 1
Views: 584
Reputation: 562891
mysqlimport -u USERNAMEHERE -pPASSWORD DATABASENAMEHERE < path/to/dbdump.sql
This is wrong usage for mysqlimport
. The error message shows you the proper usage:
Usage: mysqlimport [OPTIONS] database textfile...
You name the text file(s) as arguments, not as standard input redirection as with the usage of the mysql
client.
Also, mysqlimport
cannot read an .sql file, it reads one or more text files in CSV format. The name of the file(s) must be the names of the corresponding tables to load data into. Please read the mysqlimport documentation before attempting to use this tool.
mysql -u USERNAMEHERE -pPASSWORD DATABASENAMEHERE < path/to/dbdump.sql
This is correct usage for reading an .sql file, but the error you described indicates that the file doesn't contain an SQL script:
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 'mysqlimport Ver 3.7 Distrib 5.5.41, for debian-linux-gnu (x86_64) Copyright (c)' at line 1
It seems like the file contains the output of running the mysqlimport command. I suspect that you got confused about <
versus >
, and did this:
mysqlimport -u USERNAMEHERE -pPASSWORD DATABASENAMEHERE > path/to/dbdump.sql
If you did this, then unfortunately your dump file has been overwritten by that command, and the contents replaced with the output errors from your mysqlimport command. You should check the size and contents of that file and see.
ls -l /home/minecraft/MySQLBackup/infinity_prism_Jun_05_2015_20_01.sql
less /home/minecraft/MySQLBackup/infinity_prism_Jun_05_2015_20_01.sql
You should search your shell history to see what commands you ran:
history | grep infinity_prism
If this is what happened, then your data backup has been clobbered. You'll have to get a new data backup from the original database, if you still have it.
If you clobbered your backup and you don't still have the original database to create a new backup from, then I'm terribly sorry, but your data is gone.
Upvotes: 0
Reputation: 17091
I am not sure, but you can try to add host:
mysql -hHost -uUser -pPass -DBase < dumpFile.sql
it works for me everytime...
Upvotes: 0
Reputation: 3646
Try:
--password=YourPassword
And you should be able to use mysql. The mysqlimport is for imported teb-delimited text files and such as that.
Upvotes: 1
Reputation: 23409
Google for "BigDump"
It's a light weight, single page PHP script. You download it, put your database info in the source, then upload it to your server.
It will handle your imports that are too big for phpMyAdmin by uploading them in pieces.
Upvotes: 0