Help How Do I Backup Mysql Database With This Code - Webmasters - Nairaland
Nairaland Forum › Science/Technology › Webmasters › Help How Do I Backup Mysql Database With This Code (1200 Views)
| Help How Do I Backup Mysql Database With This Code by talk2hb1(op): 8:42am On Jun 13, 2011 |
Help Nlander's I just developed an intranet application for a client with PHP and using MYSQL as the backend database. My problem is Backing it up automatically, I tried using this Script but $username = "my_username"; //database username $password = "password"; //database password $hostname = "localhost"; //database host localhost $database = "clients_database"; //my database name $username =escapeshellcmd($username);//esscaping for shell command $password =escapeshellcmd($password); $hostname =escapeshellcmd($hostname); $database =escapeshellcmd($database); $backupFile= dir(_FILE_).$database.'.sql'; //name of the backup file $command = "mysqldump --user=$username --password=$password --host=$hostname $database > $backupFile"; //backingup command system($command, $result); //running the command Every time I run the code the result file is always empty even there is data in the database Help Guys what is wrong with my code? |
| Re: Help How Do I Backup Mysql Database With This Code by talk2hb1(op): 2:45pm On Jun 13, 2011 |
Guys wainting for your reply |
| Re: Help How Do I Backup Mysql Database With This Code by Nobody: 3:07pm On Jun 13, 2011 |
All those codes that are working with shell command tend to misbehave on windows sometimes, i think they were meant to work properly for linux. I once had that kinda problem before. Well, i once did something like that - but the script was lost due to carelessness - after searching the web endlessly, i could not find a satisfactory one, i made it for an intranet application too. You may consider using an msdos batch file to backup the database file directly. . . |
| Re: Help How Do I Backup Mysql Database With This Code by talk2hb1(op): 1:17am On Jun 15, 2011 |
Thanks Big Boss, I never tought of that. Gracias |
| Re: Help How Do I Backup Mysql Database With This Code by talk2hb1(op): 1:18am On Jun 15, 2011 |
Thanks Big Boss, I never tought of that. I am going tu try that sharp sharp. Gracias |
| Re: Help How Do I Backup Mysql Database With This Code by Nobody: 12:41pm On Jun 15, 2011 |
You can take a look at this - http://www.phpclasses.org/package/4017-PHP-Backup-large-MySQL-databases-into-multiple-files.html I am still checking my backups for that script i wrote earlier, if i can find it, i will post it here. Funny, i never got down to using it after i finished creating it. But this phpclasses.org script seem familiar - i must have used it before |
Backing Up Your Remote Mysql Database With Mysqldumper • What Does Mysql Database Means? • How To Upload Mysql Database To Server • 2 • 3 • 4
Assemblies Of God Church Website Hacked • [help Needed]need To Embed A Secure Payment System For My Web Site • Wapka Site For Sale.