I have two shared server (Server 1 and server 2) and one dedicated server.in the dedicated server i am running a script that will insert data in to server 1.
Now i want to sync all data from the sever 1 to server 2 in each month (Basically keeping backup database)
For the Server 1 and 2 , i dont have root access . So i have to do it in the Dedicated server.
is there any way that i can do using mysql -host -u -p comment ??
if there is any other idea , can you help me out ?
As the question states to sync all data from one server to another, I think you can use a relatively simple solution, involving
mysqldump.I think you can do this all from the dedicated server:
Replace
<username>,<password>,<port>and<server 1 hostname>with the connection details for server 1. Replace with the name of the database on server 1 you want to copy to server 2. If you want to copy all database, replace with the –all-databases option.This will make a file called
dump.sqlin the current directory. You can then load this into server 2:Replace
<username>,<password>,<port>and<server 2 hostname>with the connection details for server 2.This will take the dump.sql file, and load it into the database on server 2. This will drop the database on server 2 – so all existing data will be replaced with that in
dump.sql.Check the options to mysqldump (regarding drop databases, drop tables etc) and tailor the above commands to be suitable for your situation. I think, if you hook things up correctly, you could even bypass the intermediate file and connect the mysqldump on server 1 to mysql on server 2 using a socket.
To cover the ‘automated’ part of this question, you could run the above commands under cron and schedule them to run on the first day of every month at a suitable time.