您的位置 首页 php

怎样使用PHP自动备份数据库

怎样使用PHP自动备份数据库

1、前言

mysql数据库的备份方式有很多;

例如:

1、使用mysqldump函数

mysqldump -u username -p dbname table1 table2 … > BackupName.sql

  1. dbname参数表示数据库的名称

  2. table1和table2参数表示需要备份的表的名称,为空则整个数据库备份;

  3. BackupName.sql参数表设计备份文件的名称,文件名前面可以加上一个绝对路径。通常将数据库被分成一个后缀名为sql的文件;

基本使用:

怎样使用PHP自动备份数据库

2、管理工具

怎样使用PHP自动备份数据库

备份数据库的方法很多,上面两种比较常见

而本次主要讲解如何通过php函数来自动备份数据库


2、相关函数介绍

2.1 、fopen

详情参考:

怎样使用PHP自动备份数据库

2.2、array_keys

详情参考:

怎样使用PHP自动备份数据库

2.3、array_values

怎样使用PHP自动备份数据库

2.4、implode

详情参考:

怎样使用PHP自动备份数据库

2.5、 substr

详情参考:

怎样使用PHP自动备份数据库

2.6、fwrite

详情参考:

怎样使用PHP自动备份数据库


3、实现思路

怎样使用PHP自动备份数据库


4、代码构成

怎样使用PHP自动备份数据库

怎样使用PHP自动备份数据库

怎样使用PHP自动备份数据库


5、结语

备份数据库的主要过程:

1. 切换到对应的数据库;

2. 使用show create table tableName,获得表结构,写到文件中;

3. 然后查询所有的表数据,循环生成相对应 sql语句 ,写到文件中;

4. 试运行生成的sql文件;

文章来源:智云一二三科技

文章标题:怎样使用PHP自动备份数据库

文章地址:https://www.zhihuclub.com/79203.shtml

关于作者: 智云科技

热门文章

评论已关闭

33条评论

  1. Viagra merely helps with the physical aspect of ED by increasing blood flow in the penis and allowing erections to be stronger Contraindicated 1 nitroglycerin transdermal, tadalafil

  2. Fact 2 Men are 3 times more likely to have Erectile Dysfunction if they also have diabetes

  3. Motivations for using online pharmacies as a source of tramadol reported by nontraditional users N 96 Please seek medical advice before starting, changing or terminating any medical treatment

  4. Supernatants were harvested 5 h after AP1 or nigericin treatment, and IL- 1ОІ was detected or quantified by three different assays. PubMed 20648003.

  5. Its being cracked down on because everybody and their grandma wants nolva Both trials began in the early 1990s and completed subject enrollment in 2000

  6. found that fish oil rich in omega 3 fatty acids prevented MDA MB 231 human breast cancer cell metastasis to bone in nude mice 60, and Kim et al Writing in the journal Pediatrics, Jocelyn Lebow, PhD,

  7. The most dramatic decrease was observed with the N23 mutant, which was imported at a rate nearly 80 less than WT NOL7, with a p value of 6 This estrogenic product is isolated from the urine of pregnant horses PREgnant MARes urINe

  8. cetilpiridinio bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato bencidamina, clorhidrato benfluorex benfluorex benzoilo, peroxido benzoilo, peroxido benzoilo, peroxido asoc

  9. Drug interactions with doxycycline eyelid clns 3 eyelid emollient 1 and calcium polycarbophil oral THE RANDOMIZED noninferiority French PHARE trial of 3, 384 patients evaluated whether a shorter course of trastuzumab 6 months might yield benefit that was comparable to the standard 12 months of treatment

  10. 1 After allogeneic hematopoietic stem cell transplantation, rhabdomyolysis has been reported in association with bacterial 2 and fungal 3 infections, and has also occurred as a complication of sulfamethoxazole trimethoprim 4 and statin 5, 6 administration

  11. The result of cell viability and cell cycle analysis revealed increased sensitivities of doxorubicin and cisplatin in estrogen exposed MCF 7 and T47D cells as compared to their respective control cells The crystalline compound of embodiment 2, wherein the XRPD pattern comprises at least five 2theta values selected from 9

  12. Similar to previously reported results, postmenopausal women had an increase in BMD at the hip 0 The sickest people, with the most togain, signed up early in the initial enrollment period, but lotsof people waited to enroll at the very end, he said

  13. You got off your high blood pressure medications and are doing OK While early stages of cataracts may not be noticeable, as they progress, you may experience symptoms including

  14. Bai Jianxian said tentatively, do diabetes control natural foods not drink tea and go again Chen Lin shook his head smoking raise blood sugar and said with emotion In recent years, the office monks of our Sky Profound Alliance have indeed become less and less

  15. 34 Data from the National Program of Cancer Registries showed that, in the states of Alabama and Louisiana, up to 24, 000 individuals with a recent diagnosis of cancer may have been affected or displaced by Katrina

  16. He has been declared the heir to the throne by the Grand Duke, It s best diuretics can raw almonds help lower blood pressure best diuretics just that Gnavara what to take for low blood pressure is arrogant and jealous, with vicious methods and blatant rejection of dissidents

  17. Gillanders and his team have identified mammaglobin A, a breast cancer associated protein, as an excellent target for vaccine therapy

  18. Pericyte injury and or degeneration are found in multiple neurological disorders exhibiting neurovascular dysfunction and BBB breakdown

  19. Also reported to enhance feelings of well being Gynaecomastia, fluid retention and hypertension are commonly reported Oxandrolone Relatively mild androgenic properties, so popular with women 2003 Sep 15; 18 6 587 94

网站地图