dump mysql using PHP script
// DB connection info
$host = "";
$user = "";
$pwd = "";
$db = "";
$backup_file = 'dbname'. date("Y-m-d-H-i-s");
// Connect to database.
try {
$command = "mysqldump --opt -h $host -u $user -p $pwd dbname > $backup_file.sql";
exec($command);
}
catch(Exception $e){
die(var_dump($e));
}
Written by teknonono
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Php
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#