MySQL backup script

xiaoxiao2021-03-06  100

Operating system: Windows2000 Professional

Database: mysql server4.0.18

First create a batch file, here is DBBackup.bat

Then add the following in the file:

REM determines whether the mysql service is started, then output the query result in the server.log file netstat -na | (Find "0.0.0.0:3306" & Find "Listening"> Server.logrem manually established an empty file Temp.log To compare the Server.log file comparison with the server.log file compared to Temp.log, if the MySQL service has been launched, there will be information in the server.log file. Otherwise, if the fc server.log temp.logrem is started with mysqldump directly; if it is not started, the server.log file is empty, then start the database first, then back up if not not NOT Errorlevel 0 goto backup @ echo trying to boot mysql service .......... ok net start mysql: backupmysqldump -urooth mySQL> Back_% Date: ~ 4%. SQL

Note: 4 in "% date: ~ 4%" 4 indicates the date format of the final display

"4" said that the year is displayed

"8" means only the month

"12" means only the date

转载请注明原文地址:https://www.9cbs.com/read-123815.html

New Post(0)