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
recent comments