Also, on most shared servers, you have access to MyPHPAdmin control panel. In there, you can select your database and use the EXPORT option to save a full copy of it. Then, you can IMPORT it on your other server the same way. Or, if you want to do it with code, you can use something like this:
// Create a new full backup
$filename='Database-Name_database_backup_'.date('Y-m-d').'.sql';
$result=exec('mysqldump ' . $DatabaseName . ' -u' . $DatabaseUserName . ' -p' . $DatabasePassword . ' > ' . $filename);
// We now have a full backup of the database, start a download of the file to the local system...
header('Content-Type: application/download');
header('Content-Disposition: attachment; filename=' . $filename);
header("Content-Length: " . filesize($filename));
$fp = fopen($filename, "r");
fpassthru($fp);
fclose($fp);
With this code, you just need to run the page and it will force a full backup of the database to download to you in SQL format. Then, import it into your full server’s MyPHPadmin control panel. On several sites I manage, I use this called by a button to backup databases or even just one table at a time. Works great.