Creating a MySQL Dump File From an External Database
I needed to export a MySQL database that was on a different server than the web server and was bound and determined to do it without going through the hassle of installing phpMyAdmin (port 3306 was blocked as well, so I couldn’t use any GUI tools either). The trick was adding the
-h option. Here’s the command line that made some magic:
mysqldump -u username -p -h dbserver.host.com --compatible=mysql40 dbname > filetosave.sql
--compatible command was added because the database server was running MySQL 4.1 and we needed the export for MySQL 4.0.