Export Database Remote SSH
The following guide describes how to quickly export a database remotely via ssh from a remote server.
A long time ago I described the way to exporting mysql database locally.
Today I will show you how to download the database directly to your server.
The whole thing is not much different.
The command looks like this:
1 | mysqldump -u użytkownik_bazy -p nazwa_bazy -h nazwa zdalnego hosta_bądź IP> nazwapliku.sql |
Example:
1 | mysqldump -u pesco -p pesco -h sql.pesco.nazwa.pl> pesco.sql |
The name of the database and user in this case is pesco.
The remote host is sql.pesco.nazwa.pl
a file named pesco.sql will be created
If the base is on a non-standard port, e.g. 3307 we can add an appropriate argument, e.g. :
1 | --port=3307 |
The comment will be as follows:
1 | mysqldump -u użytkownik_bazy -p nazwa_bazy -h nazwa zdalnego hosta_bądź IP --port=3307> nazwapliku.sql |
Important note.
In order to be able to download the database in this way, the database must be able to connect remotely!
After such a quick export, we will also very quickly import the database with us, but that's right I described here before.