Our current website is hosted by the design agency who originally built the website, however we are bringing the development of the website in house therefore need
to export the database from their server and import it
to ours.
We have FTP and phpMyAdmin access but don't have SSH access
to the server. I was hoping
to run a PHP script that would mysql dump the database, compress it and then copy it across
to our server using scp:
$backupFile = $_SERVER['DOCUMENT_ROOT'].'/backup' . date("Y-m-d-H-i-s") . '.gz';
system("mysqldump -h DB_HOST -u DB_USER -pDB_PASS DB_NAME | gzip > $backupFile");
exec("sshpass -p PASSWORD scp -r -P PORT_NUMBER $backupFile
[email protected]:/path/to/directory/");
I have ran this locally from the command line and it worked fine, although I had
to install sshpass (the hosting server might not have this installed). Also, I was hoping
to run it from the browser as I don't have command line access on the hosting server, however it didn't work, no errors produced though.
Can you anyone recommend how I can
export from the server that I don't have SSH access
to and import
to my server?
Thanks