1

I'm trying to restore a database backup created using mysqldump. If I do:

    $ mysqldump -u ROOT -p DATABASE_NAME < DATABASE.SQL

the database remains empty, even though I get some screen output and the line "Dump completed...", followed by a timestamp. I could not spot any error messages in the output

I made sure I quit MySQL before attempting the restore and I have tried to include the password in the command line, with no success. However, if I try:

    mysql>source /path_to_dump_file/DATABASE.SQL

it works just fine.

Any thoughts?

Many thanks in advance.

1

Try

mysql -u ROOT -p DATABASE_NAME < DATABASE.SQL

instead of

mysqldump -u ROOT -p DATABASE_NAME < DATABASE.SQL
0

To IMPORT:

ype the following command to import sql data file:

$ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

In this example, import 'data.sql' file into 'blog' database using vivek as username:

$ mysql -u sat -p -h localhost blog < data.sql

If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:

$ mysql -u username -p -h 202.54.1.10 databasename < data.sql

OR use hostname such as mysql.cyberciti.biz

$ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql

If you do not know the database name or database name is included in sql dump you can try out something as follows:

$ mysql -u username -p -h 202.54.1.10 < data.sql

Refer: http://dev.mysql.com/doc/refman/5.6/en/mysqldump.html

If you want a GUI tool then you could probably use navicat for this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.