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? 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/ 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 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 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 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"; } ?> 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
Archived
This topic is now archived and is closed to further replies.