Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to backup MySQL database on a remote server?

I have a MySQL database existing on a remote server. I only have sql 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)?

like image 892
john smith Avatar asked Oct 23 '13 20:10

john smith


People also ask

Can I copy MySQL data directory to another server?

You have to shut down mysql server (which is not good, if it's a production server) You have to make sure the permission of data (mysql) directory is same as the previous one. You will have to monitor the mysql_error log while starting the second server.

How do I backup multiple MySQL databases?

To backup multiple MySQL databases with one command you need to use the --database option followed by the list of databases you want to backup. Each database name must be separated by space. The command above will create a dump file containing both databases.


1 Answers

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

mysqldump --host servername dbname > dbname.sql 
like image 182
Barmar Avatar answered Sep 17 '22 08:09

Barmar