Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to automatically back up and compress mysql regularly under windows

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

In this issue, the editor will bring you about how the mysql under windows is automatically backed up and compressed regularly. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

Working environment Windows Server 2003, MySQL installation directory D:Program FilesMySQLMySQL Server 2003, WinRAR installation directory C:Program FilesWinRAR

The path of backup data storage is E:dataBackupMySQL. Here is the source file for the windows command line batch command

The code is as follows:

Set dancers% daterime 0pl 10%

Set dvv% dvl%

Set tweets% timebank 0pl 8%

Set tweets% tpurs

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 FilesMySQLMySQL Server 5.0inmysqldump.exe"-hlocalhost-- opt-uroot-pyoumysqlrootpassword discuzuc uc_admins uc_applications uc_badwords uc_domains uc_failedlogins uc_feeds uc_friends uc_mailqueue uc_memberfields uc_members uc_mergemembers uc_newpm uc_notelist uc_pms uc_protectedmembers uc_settings uc_sqlcache uc_tags uc_vars > "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 use the .bat batch file: mysql_dump

You need to use winrar here, assuming that the code installed on C:Program FilesWinRAR uses rar.exe, the command-line version of the rar tool (recommended), rather than the graphical version of winrar.exe. Of course, check to see if there is a rar.exe file in your winrar installation directory. If not, it is recommended to download the full version of winrar again.

It is assumed that you need to back up several tables (ucenter tables) in the database discuzx and discuzuc. [this is the case if you upgrade and install discuzx without importing ucenter into discuzx's library]

Save the above command as mysql_dump.bat and double-click to run it. In order to automate unattended processing, this command can be executed periodically through the system's task schedule.

The above is how the mysql under windows is automatically backed up and compressed regularly. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report