Advertisement
Guest User

Untitled

a guest
Oct 10th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. #create directory based on date
  3. $path = './'.date('Y-m-d');
  4. #check directory existance
  5. if (!file_exists($path))
  6. mkdir($path, 0777, true);
  7.  
  8. #initiate database information
  9. $database = 'classicmodels';
  10. $user = 'mysql';
  11. $pass = '';
  12. $host = 'localhost';
  13. #
  14. $dir = $path . '/dump.sql';
  15. echo "<h3>Backing up database to `<code>{$dir}</code>`</h3>";
  16. exec("mysqldump --user={$user} --password={$pass} --host={$host} {$database} --result-file={$dir} 2>&1", $output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement