Home >Database >Mysql Tutorial >Mysql自动备份与还原方法_MySQL

Mysql自动备份与还原方法_MySQL

WBOY
WBOYOriginal
2016-06-01 13:21:09755browse

bitsCN.com 一、自动备份:将以下代码保存为*.bat批处理脚本,然后再添加Windows定时作业,如每天凌晨2点执行:
set s=%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%
mysqldump -u root -ppassword databasename > d:/databasename_%s%_bak.sql

说明:databasename 为数据库名 password为数据库密码,系统自动以当前日期时间备份至指定目录。

二、还原数据库: mysql -u root -p databasename

Statement:
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