Recommend this page to a friend! |
![]() ![]() |
Info | ![]() |
![]() ![]() |
Reputation | Support forum (15) | Blog | Links |
Ratings | Unique User Downloads | Download Rankings | ||||
![]() ![]() ![]() ![]() | Total: 5,184 This week: 1 | All time: 507 This week: 159![]() |
Version | License | Categories | ||||
mysql-backup 1.0.0 | GNU General Publi... | Databases, Systems administration |
Description | Author | |||||||||||||||||||||||
This class can be used to backup MySQL database to files that contain SQL statements to recreate the database. |
|
MySQL database backup class, version 1.0.0 HOW TO USE 1. Create the instance of MySQL_Backup class. 2. Define necessary properties. 3. Call Execute() method to create backup. require_once 'mysql_backup.class.php'; $backup_obj = new MySQL_Backup(); $backup_obj->server = 'localhost'; $backup_obj->username = 'username'; $backup_obj->password = 'password'; $backup_obj->database = 'dbname'; $backup_obj->tables = array(); $backup_obj->drop_tables = true; $backup_obj->struct_only = false; $backup_obj->comments = true; $backup_obj->fname_format = 'd_m_y__H_i_s'; if (!$backup_obj->Execute(MSB_DOWNLOAD, '', true)) { die($backup_obj->error); } PUBLIC PROPERTIES var $server = 'localhost'; The name of MySQL server. var $port = 3306; The port of MySQl server. var $username = 'root'; Database username. var $password = ''; Database password. var $database = ''; Name of the database. var $link_id = -1; MySQL link identifier of the current connection. You can set this if you want to connect the MySQL server by your own. var $connected = false; Set true if the connection is already established before calling Execute(). var $tables = array(); Tables you want to backup. All tables in the database will be backed up if this array is empty. var $drop_tables = true; Add DROP TABLE IF EXISTS queries before CREATE TABLE in backup file. var $struct_only = false; Only structure of the tables will be backed up if true. var $comments = true; Include comments in backup file if true. var $backup_dir = ''; Directory on the server where the backup file will be placed. Used only if task parameter equals to MSB_SAVE in Execute() method. var $fname_format = 'd_m_y__H_i_s'; Default file name format. var $error = ''; Error message. PUBLIC METHODS function Execute($task = MSB_STRING, $fname = '', $compress = false) $task - operation to perform: MSB_STRING - return SQL commands as a string; MSB_SAVE - create the backup file on the server; MSB_DOWNLOAD - save backup file in the user's computer. $fname - optional name of backup file. $compress - use GZip compression? |
![]() |
File | Role | Description |
---|---|---|
![]() ![]() |
Example | Example of usage |
![]() |
Class | Source |
![]() ![]() |
Doc. | Readme |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
User Ratings | User Comments (8) | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.
Pages that reference this package |
PHP and MySQL to backup (Turkish) I want to get a complete backup of MySQL with PHP... |