In windows, mysql automatically backs up and compresses regularly (take the discuz Forum as an example) _ MySQL

Source: Internet
Author: User
In windows, mysql automatically backs up and compresses regularly (take discuz Forum as an example) bitsCN.com

Working environment Windows Server 2003, MySQL installation directory D: Program FilesMySQLMySQL Server 5.0, WinRAR installation directory C: Program FilesWinRAR
The path to the backup data storage is E: dataBackupMySQL. The following is the source file of the windows command line batch processing command.

The code is as follows:

Set d = % date :~ 0, 10%
Set d = % d:-= %
Set t = % time :~ 0, 8%
Set t = % t: = %
Set dzxpath = dzx % p % d % t %. SQL
Set ucpath = uc % p % d % t %. SQL
Set folder = E: dataBackupMySQL
Echo off

"D: Program FilesMySQLMySQL Server 5.0inmysqldump.exe"-hlocalhost -- opt-uroot-pyoumysqlrootpassword discuzx> "% folder % dzxpath %"
"C: Program FilesWinRARRAR.exe" a-ep1-r-o +-m5-s-df "% folder % dzxpath %". rar "% folder % dzxpath %"

"D: program login Server certificate "-hlocalhost -- opt-uroot-certificate uc_admins uc_applications uc_badwords education Program Education uc_friends Program Education uc_members Program Education uc_pms education uc_settings uc_sqlcache certificate>" % folder % ucpath %"

"C: Program FilesWinRARRAR.exe" a-ep1-r-o +-m5-s-df "% folder % ucpath %". rar "% folder % dzxpath %"
Rem echo "D: Program FilesMySQLMySQL Server 5.0 datadiscuzx/% filepath %"
―――――――-

You can directly download the. bat batch processing File: mysql_dump

Here we need to use winrar. assume that the rartool installed in the C: Program FilesWinRAR code uses the rar.exe command line (recommended version, but not winrar.exe graphical version. Of course, check that your winrarinstallation directory contains the file rar.exe. if not, we recommend that you download the full version of winrar again.

Assume that several tables (ucenter tables) in the discuzx and discuzuc need to be backed up. [this is the case if discuzx is upgraded and not imported into the discuzx Database.]

Save the preceding command as mysql_dump.bat and double-click it to run it. To achieve unattended automatic processing, you can regularly execute this command through the system's task plan.

If you do not plan a windows task, search for it and learn it by yourself. we will not go into details here.


BitsCN.com

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.