直接放脚本
@echo off
rem 时间
set year=%date:~0,4%
set month=%date:~5,2%
set day=%date:~8,2%
rem 命名
rem set dbname=dbname_%year%%month%%day%.sql
rem 用mysqldump导出备份整个数据库,命名为上自定义
mysqldump -h192.168.1.1 -uuser -ppasswd dbname >d:MySqlback\%dbname%;
rem 用mysqldump导出数据库为dbname的表结构
mysqldump -uuser -ppasswd -d dbname >d:MySqlback\%dbname%;
rem 用mysqldump导出数据库为dbname某张表结构
mysqldump -uuser -ppasswd -d dbname table_name>d:MySqlback\%dbname%;
rem 用mysqldump导出数据库为dbname所有表结构及表数据
mysqldump -uuser -ppasswd dbname >d:MySqlback\%dbname%;
rem 用mysqldump导出数据库为dbname某张表结构及表数据
mysqldump -uuser -ppasswd dbname table_name>d:MySqlback\%dbname%;
rem 用mysqldump批量导出dbname数据库中多张表结构及表数据
mysqldump -uuser -ppasswd dbname table_name1 table_name2 table_name3>d:MySqlback\%dbname%;
rem 用mysqldump批量导出dbname数据库中多张表结构
mysqldump -uuser -ppasswd -d dbname table_name1 table_name2 table_name3>d:MySqlback\%dbname%;
@echo off