Thursday, 18 March 2010

mysqldump from remote host

First you need to set the appropriate privileges on the target SQL server.

In this instance I want to use mysqldump to backup a database using a nightly script.

For this example assume the following;

mysql server host:
target database: mydb
Backup host:
Backup username: backup

On the mysql server log in as root with;

mysql -u root -p

Enter this on the mysql console;

flush privileges;

On the backup server run this command;

mysqldump --host=myserver -u backup mydb > test.sql

Assuming that works, you can put the final command into your backup shell script or simply place it in your crontab.


Bruce said...

Thank you :-)

Manoj Bardhan said...

Help me,
I need mysqldump in remote server .

when I am running in my own pc (localhost) its works find but when the script is running in server not working.

File is created but no data.

Help Me.

sgr said... worked really well for me.. :)