mysqldump
works for remote hosts - use the -h
flag to specify the host to connect to (and ensure that your shared hosting account is configured to accept connections from the remote host IP and access credentials).
It's also very likely that mysqldump
is installed on the server and it is further likely that PHP's execution operators are enabled (a horrible idea for shared hosting, but sadly quite common) so you may be able to use PHP to execute shell commands and accomplish your goal.
Edit: If remote MySQL connections and execution operators are disabled, the cURL script which phrac recommended may be a solution, but even if that script does not meet your needs, you still have options (if you can access the data and run scripts, you can always get a copy).
If mysqldump
is installed on your shared hosting server you could create a cron job to dump the database to a web-accessible directory - e.g. mysqldump dbname > /path/to/www/subdir/backup.sql
(just make sure the subdirectory blocks access by untrusted IP addresses)
If you don't have mysqldump
on the shared hosting server, you could write a PHP script which executes a SELECT ... INTO OUTFILE
query (again, under a protected web-accessible directory with lenient write permissions).
If you don't have the option grant a MySQL user sufficient privileges to write to an outfile, you could still write a PHP script which (it's an ugly solution) echoes the MySQL INSERT
statements for your data in response to requests and put that script in a web-accessible directory.