Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Database Backup
 

Reference / Php / Database Backup

Backup a MySQL database by dumping the contents to file.


$dbhost = 'localhost'; // Server address of your MySQL Server
$dbuser = 'user'; // Username to access MySQL database
$dbpass = 'pass'; // Password to access MySQL database
$dbname = 'db'; // Database Name

$date = date("dmy-hia");

$filename = "$savepath/$dbname-$date.sql";

passthru("mysqldump --opt -h$dbhost -u$dbuser -p$dbpass $dbname >$filename");





Please note that a disclaimer applies to any code on this page.

 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
     - Javascript
     - Mysql
     - Php
          - Calculate Date Yesterday
          - Database Backup
          - Ftp Upload
          - Gzip File
          - List Files In Directory
          - Previous Sql Insert Id
          - Send Email
          - Server Visitor Properties
          - Set Global Get And Post Variables
          - Sql Query Results
     - Standards
     - Windows Os
- Script Editors
- Tutorials
- Vbscript