i want to take backup of my database with a single click of user. I am using mysqldump to do so, It creates .sql file but not contain any thing int it. Here is the code. $backupFile = $dbname . date("Y-m-d") . '.sql'; $command = "mysqldump --opt -h $host -u $user -p $password $database > $backupFile"; $backupCheck = system($command); if($backupCheck) { echo ("Success"); } else { echo ("Fail bakcup"); } Plz help me , wat wrong with this code and how can i solve my problem
Should you be specifying full path to mysqldump? Usually /usr/bin/mysqldump on *nix servers And just in case, you are setting the host, user, pass and database vars, right?
Vars hots, user, password and datbase are 100% right, I m sure about that. The second thing is not clear ...... i want to take and test backup at localhost host using Apache webserver and mysql 4.19 version and then i want to shift that backup code to online. What can i do.
So you have this script setup on a local server, Windows? Try $command = 'c:\path\to\mysql\bin\mysqldump ...
Hi, On localhost i tried this $command = "C:\Program Files\EasyPHP1-8\mysql\bin\mysqldump --opt -h $host -u $user -p $password $database > custback.sql"; but it fails again. Again it creats custback.sql file but again with 0KB. Plz help me how can i solve it.
If you have access to the console on your server - for example, through putty, run the command manually without the redirect (> custback.sql) so that you can see any error returned in the console.