gongpex Posted December 1, 2016 Share Posted December 1, 2016 Hello everyone, I look on google if we want to backup up data from mysql we run code like this : <?php $dbhost = 'localhost'; $dbuser = 'root'; $dbpass = 'root'; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die('Could not connect: ' . mysql_error()); } $table_name = "kol1"; $backup_file = "F:/test.sql"; $sql = "SELECT * INTO OUTFILE '$backup_file' FROM $table_name"; mysql_select_db('test'); $retval = mysql_query( $sql, $conn ); if(! $retval ) { die('Could not take data backup: ' . mysql_error()); } echo "Backedup data successfully\n"; mysql_close($conn); ?> This code works, but only backup one table (kol1), Q : Is there any solution to backup all table from database? please help me Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted December 1, 2016 Share Posted December 1, 2016 Use mysqldump: http://dev.mysql.com/doc/refman/5.7/en/mysqldump.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now