Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extracting a remote MySQL Database without MyODBC?

Is there a way to get a MySQL Dump of a database that is not stored locally. I have the connection string to the database located on another server, but it doesn't seem like MySQLDump wants to do anything if the server is remote.

like image 513
coderama Avatar asked Dec 17 '10 07:12

coderama


People also ask

How can I access my database remotely?

via cPanel To add your computer as an Access Host: Log in to cPanel. Under the Databases section, click on the Remote MySQL® icon. On the Remote MySQL® page, enter the connecting IP address, then click Add Host.


1 Answers

MySQLDump has a -h parameter to connect to a remote host.

First try the mysql client application:

mysql -h your.server.com -uYourUser -pYourPass

If that works, use the same format for MySQLDump

mysqldump -h your.server.com -uYourUser -pYourPass --all-databases

Edit for ajreal:

By default, mysqld (the MySQL server) will run on 3306, and mysql (the client application) will connect using that port. However, if you changed your configuration, update your command accordingly. For example for port 3307, use

mysql -h your.server.com -P 3307 -uYourUser -pYourPass

Check your MySQL configfile to see how you can connect to your MySQL server.

like image 123
Konerak Avatar answered Oct 07 '22 00:10

Konerak