• window下数据库自动备份脚本


    ::换成默认的gbk
    chcp 936
    rem ******MySQL backup start********
    @echo off
    ::如果没有则创建数据库文件夹
    IF NOT EXIST "D:db_backup" MD "D:db_backup"
    ::删除超过30天的备份
    forfiles /p "D:db_backup" /m *_backup_*.sql -d -30 /c "cmd /c del /f @path"
    
    ::定义时间
    set data_time=%date:~0,4%%date:~5,2%%date:~8,2%
    ::定义mysqldump.exe所在目录+mysqldump
    set "mysqldump=D:programmysql-5.7.21-winx64inmysqldump"
    ::定义mysql连接
    set "mysql_connect=--opt --single-transaction=TRUE --user=root --password=nyt@aA? --host=127.0.0.1 --protocol=tcp --port=3306 --default-character-set=utf8 --single-transaction=TRUE --routines --events"
    
    IF NOT EXIST "D:db_backupeucenter" MD "D:db_backupeucenter"
    %mysqldump% %mysql_connect% "eucenter" > D:db_backupeucentereucenter_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backupmlgl_bm" MD "D:db_backupmlgl_bm"
    %mysqldump% %mysql_connect% "mlgl_bm" > D:db_backupmlgl_bmmlgl_bm_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backupmlgl_nyt" MD "D:db_backupmlgl_nyt"
    %mysqldump% %mysql_connect% "mlgl_nyt" > D:db_backupmlgl_nytmlgl_nyt_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backupsdnyt" MD "D:db_backupsdnyt"
    %mysqldump% %mysql_connect% "sdnyt" > D:db_backupsdnytsdnyt_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backupsaiku" MD "D:db_backupsaiku"
    %mysqldump% %mysql_connect% "saiku" > D:db_backupsaikusaiku_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backupGIS_dlkj" MD "D:db_backupGIS_dlkj"
    %mysqldump% %mysql_connect% "GIS_dlkj" > D:db_backupGIS_dlkjGIS_dlkj_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    cpsc" MD "D:db_backup
    cpsc"
    %mysqldump% %mysql_connect% "ncpsc" > D:db_backup
    cpsc
    cpsc_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    cpscjyzt" MD "D:db_backup
    cpscjyzt"
    %mysqldump% %mysql_connect% "ncpscjyzt" > D:db_backup
    cpscjyzt
    cpscjyzt_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    cpzz" MD "D:db_backup
    cpzz"
    %mysqldump% %mysql_connect% "ncpzz" > D:db_backup
    cpzz
    cpzz_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    jtg" MD "D:db_backup
    jtg"
    %mysqldump% %mysql_connect% "njtg" > D:db_backup
    jtg
    jtg_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    ykjfw" MD "D:db_backup
    ykjfw"
    %mysqldump% %mysql_connect% "nykjfw" > D:db_backup
    ykjfw
    ykjfw_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    ysczl" MD "D:db_backup
    ysczl"
    %mysqldump% %mysql_connect% "nysczl" > D:db_backup
    ysczl
    ysczl_backup_%data_time%.sql
    
    IF NOT EXIST "D:db_backup
    ysthj" MD "D:db_backup
    ysthj"
    %mysqldump% %mysql_connect% "nysthj" > D:db_backup
    ysthj
    ysthj_backup_%data_time%.sql
    @echo on
    rem %data_time%
    rem ******MySQL backup end********
    ::pause
  • 相关阅读:
    有点感叹,陪伴一年多的py2终于换py3了
    一句话检测XSS
    Mongodb3.4异常无法启动的处理 Process: 6874 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=100)
    Hadoop完全云计算平台搭建
    MySQL ERROR 3009 (HY000): Column count of mysql.user is wrong. Expected 45, found 42. Created with MySQL 50560, now running 50729. Please use mysql_upgrade to fix this error.
    v-on(事件处理)
    javascript获取以及设置光标位置
    小程序图片处理
    vue api
    处理回车提交、ctrl+enter和shift+enter都不提交->textarea正常换行
  • 原文地址:https://www.cnblogs.com/a-fun/p/9391301.html
Copyright © 2020-2023  润新知