Night Walker
Night Walker

Reputation: 21260

using mysqldump to restore database to mysql located on another computer

Any idea how to do this restore ?
I looked into help of mysqldump but couldn't see it there . If so can you give me some example.

Upvotes: 2

Views: 1806

Answers (5)

sikas
sikas

Reputation: 5523

I think you can use CMD to navigate to the mysqldump location, then type this command,

mysqldump database_name -u username >location\to\save\dump.sql

change database_name to the database you want to backup, username to the username associated with the database, and location\to\save\dump.sql to the location where you want to save the output sql file, for me I wrote it D:\dump.sql

Then on the other machine you can import the SQL file using the PHPMyAdmin.

Upvotes: 1

Riedsio
Riedsio

Reputation: 9926

  1. From the shell prompt, using parameters form the mysqldump doc, mysqldump the database using a > redirect to a human readable .sql file. E.g.

    $ mysqldump --databases src_db > src_db.sql

  2. Transfer the human readable file to another machine.

  3. After making sure the destination database exists has been created, redirect < the .sql file into the destination database.

    $ mysql dest_db < src_db.sql

Upvotes: 0

travelboy
travelboy

Reputation: 2697

It's just plain SQL. Pass the file to mysql (the mysql command line tool) and it will execute it:

mysql < backup.sql

Upvotes: 0

littlegreen
littlegreen

Reputation: 7420

You can just execute the SQL using the mysql command-line command. There is a switch to specify which file to import, I think it is -I but I'm not sure.

Upvotes: 0

Pablo Santa Cruz
Pablo Santa Cruz

Reputation: 181280

With mysqldump you will generate a script you can use for restore on a different computer like this:

$ mysql -U user_name < your_backup.sql

Run on your favorite shell (windows command prompt, bash, csh...).

Upvotes: 1

Related Questions