Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,197,739 members, 7,965,774 topics. Date: Thursday, 03 October 2024 at 08:53 PM |
Nairaland Forum / Science/Technology / Webmasters / Help How Do I Backup Mysql Database With This Code (1125 Views)
Backing Up Your Remote Mysql Database With Mysqldumper / What Does Mysql Database Means? / How To Upload Mysql Database To Server (2) (3) (4)
Help How Do I Backup Mysql Database With This Code by talk2hb1(m): 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(m): 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(m): 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(m): 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 |
(1) (Reply)
Gtb Customers Beware Of This Phising Site / Скачай бесплатно софт / edit: Why Is My User Id Changed? A 24 Hours ultimatum To Revert It Back.
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |