How to backup MySQL database on a remote server?

john smith picture john smith · Oct 23, 2013 · Viewed 53.9k times · Source

I have a MySQL database existing on a remote server. I only have connection privilege. I don't have FTP access to the server, and I need to do a complete dump of the database. I have tried mysqldump, but the issue is that it is creating the output on the server and as I don't have FTP I can not get the output from the server.

How can I do a clean backup and get the dump in my local machine(of course, the backup should be restored in my local machine)?

Answer

Barmar picture Barmar · Oct 23, 2013

You can specify the server name as an option to mysqldump:

mysqldump --host servername dbname > dbname.sql