jdock1 Posted May 27, 2011 Share Posted May 27, 2011 I looked into this everywhere,but the code does not make sense, is not properly documented and is outdated. Ive been trying to achieve this for the past hour. Anybody know how I can do this? Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/ Share on other sites More sharing options...
QuickOldCar Posted May 27, 2011 Share Posted May 27, 2011 This script can do it. http://www.dagondesign.com/articles/automatic-mysql-backup-script/ Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/#findComment-1220994 Share on other sites More sharing options...
jdock1 Posted May 28, 2011 Author Share Posted May 28, 2011 This script can do it. http://www.dagondesign.com/articles/automatic-mysql-backup-script/ Thanks, but that shit sucks. I cant get it to work on my server Anybody else got a solution? A simple one with a few lines of code. That script is alot of code for a relatively simple thing Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/#findComment-1221470 Share on other sites More sharing options...
dreamwest Posted May 28, 2011 Share Posted May 28, 2011 http://www.wizecho.com/nav=php&s=php_mysql_backup Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/#findComment-1221472 Share on other sites More sharing options...
eMonk Posted May 28, 2011 Share Posted May 28, 2011 I've read it's bad to use php and other web applications to backup mysql databases (for big sites). If it timeouts the file becomes corrupt. Backing up via SSH seems more solid. Backup via SSH: mysqldump --opt -u user -p dbname > {path}/backup.sql Restore via SSH: mysql -u user -p dbname < {path}/backup.sql Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/#findComment-1221506 Share on other sites More sharing options...
dreamwest Posted May 28, 2011 Share Posted May 28, 2011 or you can use shell_exec() if you still want to use php <?php if(shell_exec("mysqldump --opt -u user -p dbname > {path}/backup.sql")){ echo "Backed up!"; }else{ echo "Failed"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/237608-how-to-backup-mysql-database-through-php/#findComment-1221507 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.