Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- exec("/usr/bin/mysqldump -u mysql-user -h 123.145.167.189 -pmysql-pass database_name > /path-to-export/file.sql", $output);
- ?>
- $return_var = NULL;
- $output = NULL;
- $command = "/usr/bin/mysqldump -u mysql-user -h 123.145.167.189 -pmysql-pass database_name > /path-to-export/file.sql";
- exec($command, $output, $return_var);
- if($return_var) { /* there was an error code: $return_var, see the $output */ }
- <?php
- exec("/usr/bin/mysqldump -u mysql-user -h 123.145.167.189 -pmysql-pass database_name", $output);
- /* $output will have sql backup, then save file with these codes */
- $h=fopen("/path-to-export/file.sql", "w+");
- fputs($h, $output);
- fclose($h);
- ?>
- <?php
- define("BACKUP_PATH", "/full/path/to/backup/folder/with/trailing/slash/");
- $server_name = "your.server.here";
- $username = "your_username";
- $password = "your_password";
- $database_name = "your_database_name";
- $date_string = date("Ymd");
- $cmd = "mysqldump --hex-blob --routines --skip-lock-tables --log-error=mysqldump_error.log -h {$server_name} -u {$username} -p{$password} {$database_name} > " . BACKUP_PATH . "{$date_string}_{$database_name}.sql";
- $arr_out = array();
- unset($return);
- exec($cmd, $arr_out, $return);
- if($return !== 0) {
- echo "mysqldump for {$server_name} : {$database_name} failed with a return code of {$return}nn";
- echo "Error message was:n";
- $file = escapeshellarg("mysqldump_error.log");
- $message = `tail -n 1 $file`;
- echo "- $messagenn";
- }
- ?>
- exec("(mysqldump -u$username -p$password $database $tables > $dump_name) 2>&1", $output, $result);
- var_dump($result);
- echo "<br />";
- var_dump($output);
- echo "<br />";
- <?php exec('mysqldump --user=name_user --password=password_enter --host=localhost database_name > filenameofsql.sql'); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement