Php exports the full mysql database to generate SQL files
Source: Internet
Author: User
The following is the detailed code for php to export the full mysql database to generate an SQL file. I hope it will help you find and make changes to the backup data during php programming.
File name: db_backup.php
The source code is as follows:
The code is as follows:
Ini_set ("max_execution_time", "180"); // avoid excessive data volume and incomplete export.
/*
Program function: mysql database backup function
Author: Tang Xiaogang
Note:
This program is mainly extracted from mysqladmin and made some adjustments. I hope it will be helpful for you to back up data during php programming.
If you do not want to back up the structure, please screen out this sentence: echo get_table_structure ($ dbname, $ table, $ crlf). "; $ crlf ";
If you do not want to back up the content, please screen out this sentence: echo get_table_content ($ dbname, $ table, $ crlf );
Revised by: he Jinsheng
Modification time: 2009/11/7
Modify content: added the get_table_structure function and commented out the get_table_def function to obtain more details during table creation (for example: ENGINE = InnoDB AUTO_INCREMENT = 80 default charset = utf8 COLLATE = utf8_unicode_ci COMMENT = 'item information change information ')
*/
$ Host = ""; // database address
$ Dbname = ""; // Configure the database name here
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.