dharma017
3/1/2016 - 11:42 AM

Bash: Download MySQL database from cPanel to development server

Bash: Download MySQL database from cPanel to development server

#!/bin/bash

# This is a script I used to download my live site database onto my development
# server when I used a web host that used cPanel, but didn't give me access to
# mysqldump over SSH (because they had Jailshell enabled).

# Note: The database name (DBNAME) excludes the account name prefix - i.e.
# "dbname" not "sitename_dbname".

curl http://USERNAME:PASSWORD@HOSTNAME:2082/getsqlbackup/DBNAME.sql.gz \
 | gunzip \
 | mysql LOCAL_DBNAME