Home > Backend Development > PHP Tutorial > How to batch backup MySQL multiple databases and save them in the same folder each time?

How to batch backup MySQL multiple databases and save them in the same folder each time?

WBOY
Release: 2016-10-17 09:29:59
Original
1366 people have browsed it

The mysql data generated by batch processing is backed up once a day. How to create a folder named after that day in batch processing and save the generated sql file in the folder

<code>@echo off
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
D:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump --opt -u root --password=123456 anna > E:\crontab\mysql\sql\bbs_anna%Ymd%.sql

D:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump --opt -u root --password=123456 typecho > E:\crontab\mysql\sql\bbs_typecho%Ymd%.sql
@echo on</code>
Copy after login
Copy after login

Reply content:

The mysql data generated by batch processing is backed up once a day. How to create a folder named after that day in batch processing and save the generated sql file in the folder

<code>@echo off
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
D:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump --opt -u root --password=123456 anna > E:\crontab\mysql\sql\bbs_anna%Ymd%.sql

D:\wamp\bin\mysql\mysql5.5.24\bin\mysqldump --opt -u root --password=123456 typecho > E:\crontab\mysql\sql\bbs_typecho%Ymd%.sql
@echo on</code>
Copy after login
Copy after login

Just create a new directory and modify it as follows according to your file:
@echo off
set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%"
mkdir E:crontabmysqlsql%Ymd%
D:wampbinmysqlmysql5.5.24binmysqldump --opt -u root --password=123456 anna > ump --opt -u root --password=123456 typecho > E:crontabmysqlsql%Ymd%bbs_typecho.sql
@echo on

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template