Apr 17

I needed to create a backup on my mysql database on remote host. I found out that there is a way that you can actually do that with mysqldump :) . I didn’t believe that it will be so easy but i decided to give it a try. After all the stuff i read on the net about it there was’nt a single working example of it – so after some testing i managed to do it :)
so here it is:

first i will show you how to use mysqldump to backup your database on your harddrive on your local computer under windows. Go to your command prompt -> Start -> Run -> write “cmd” -> hit enter
go to your mysql bin directory, in case that you use xampp, and it’s installed on c:\xampp, it should be in c:\xampp\mysql\bin
you can do that by typing “cd \” and then “cd xampp\mysql\bin” (i’m trying to write this tutorial as simple as possible so that everybody will get it :) )

after that, to backup your database on local mashine you should write:
mysqldump –add-drop-table -h localhost –user=root –password=yourpass yourDBname > OutputFile.sql

voilla :)

so if you want to backup your database to remote host the command gets a bit more sophisticated ;)
here we go:

copy databse and it’s data from one server to another:
mysqldump –user=root –password=yourPassword –opt localDB | mysql -h 192.168.1.35 –user=root –password=remotePassword remoteDB

In our case we copy our local database “localDB” into the database “remoteDB” on the machine with 192.168.1.35

we can also do the command like this:
mysqldump -h 192.168.1.17 –user=test –password=12345 –opt remoteDB
| mysql -h 192.168.1.51 –user=root –password=bg_820918 remoteDB

in this case we copy the database “remoteDB” from remote host to another remote host in the database “remoteDB”

now you see how powerfull mysqldump really is, and that’s only few of the things it’s capable of :)
I hope this will was usefull for someone :)

7 Responses to “mysql copy entire database to remote host”

  1. Manal Says:

    Great help! Im using Linux and it worked for me :-)

  2. Georgi Mitev Says:

    10x Manal, i’m glad it worked for you :)

  3. beats by dre Says:

    Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks.

  4. Cheap Moncler Vest Says:

    http://www.snow-coats.com/moncler comfort and ease. The elbow, shoulders, and complete backside of the arms have nylon

    Supplex taslan overlay, which, in layman’s phrases give you optimum defense to your most

  5. UGGS Sale Says:

    Mostly all the Websites are for the information purpose and you have also created such a great website here.Such a great ideas you have Provided here.Thank you for sharing

  6. Louboutin Sale Says:

    While Sherlock is of course a task of fiction, an speck of resolution is everlasting possible and is in sighting something that we do all the time unconsciously.

  7. nfl jerseys Says:

    Thank you for taking the time to publish this information very useful!I’m still waiting for some interesting thoughts from your side in your next post thanks.

Leave a Reply

*

Spam Protection by WP-SpamFree