Mysql is automatically backed up and compressed on a regular basis in windows (take discuz Forum as an example)

Source: Internet
Author: User

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.0datadiscuzx \ % 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.


 

 

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.