Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

can i back up mysql database from php code?

<?php
   $dbhost = 'localhost:3036';
   $dbuser = 'root';
   $dbpass = 'rootpassword';
   
   $backup_file = $dbname . date("Y-m-d-H-i-s") . '.gz';
   $command = "mysqldump --opt -h $dbhost -u $dbuser -p $dbpass ". "test_db | gzip > $backup_file";
   
   system($command);
?>
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #mysql #database #php
ADD COMMENT
Topic
Name
7+4 =