radiations3 Posted August 4, 2011 Author Share Posted August 4, 2011 OKAY JUST TELL ME ONE LAST THING THE WEB HOSTING SERVICES I AM USING IS SETUP TO LINUX SO IF YOU GIVE ME YOUR METHOD OF BACKING UP DATABASE CAN I USE IT ON MY ONLINE SERVER.. JUST GUIDE ME WHICH METHOD I MUST USE TO BACKUP MY DATABASE IN YOUR POINT OF VIEW SO I'LL START WORKING ON IT AS PER YOUR GUIDANCE???... THANKS! Quote Link to comment Share on other sites More sharing options...
WebStyles Posted August 4, 2011 Share Posted August 4, 2011 it's not really the same thing. I set up my own servers, so I actually have root access to the entire machine. First you need to check if you have any way of setting up cron tabs (in cpanel, or whatever other administration system they provide) then you need to know exactly where your database folders are... then all you need is to set up a cron tab with something like: tar -czf /path_to_BACKUP_FOLDER/filename_`date +%d-%m-%Y`.tgz /path_to_MYSQL_FOLDER and schedule it to whatever time of the day / days of the week you want Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 4, 2011 Author Share Posted August 4, 2011 WEBSTYLES THANKS ALOT FOR HELPING ME OUT I'LL TRY MY BEST TO BACK UP MY DATABASE AND GET THE HELP FROM THE TIPS YOU MENTIONED IN THIS POST.. REGARDS, FAIXY Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 6, 2011 Author Share Posted August 6, 2011 Can anyone tell what is wrong with the following code because when i run it then it saves the file of 0byte and doesnot create the backup of my database?? <?php $dbuser = "root"; $dbpass = ""; $dbhost = "localhost"; $dbname = "bakery"; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); $backupFile = $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > upload/$backupFile"; system($command); //include 'closedb.php'; mysql_close($conn); ?> Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 try this. <?php $dbuser = "root"; $dbpass = ""; $dbhost = "localhost"; $dbname = "bakery"; $conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql'); mysql_select_db($dbname); if($conn){ $backupFile = 'upload/' . $dbname . date("Y-m-d-H-i-s") . '.gz'; $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass $dbname | gzip > $backupFile"; system($command); //include 'closedb.php'; }else{ print "invalid connection"; } mysql_close($conn); ?> Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 6, 2011 Author Share Posted August 6, 2011 @phpSensei No the code didn't worked. There is no file getting saved now This is my only current issue that's not being resolved yet Quote Link to comment Share on other sites More sharing options...
phpSensei Posted August 6, 2011 Share Posted August 6, 2011 Does it print "Invalid Connection" ? Quote Link to comment Share on other sites More sharing options...
radiations3 Posted August 6, 2011 Author Share Posted August 6, 2011 NO :-\ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.