<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Chan Chen Coding...

    MySQL Auto Backup

    Below is the script example to backup mysql database in command line:-
    $ mysqldump -h localhost -u username -p database_name > backup_db.sql
    If your mysql database is very big, you might want to compress your sql file.
    Just use the mysql backup command below and pipe the output to gzip,
    then you will get the output as gzip file.
    $ mysqldump -u username -h localhost -p database_name | gzip -9 > backup_db.sql.gz
    If you want to extract the .gz file, use the command below:-
    $ gunzip backup_db.sql.gz
    Type the following command to import sql data file:
    $ mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
    In this example, import 'data.sql' file into 'blog' database using vivek as username:
    $ mysql -u vivek -p -h localhost blog < data.sql
    If you have a dedicated database server, replace localhost hostname with with actual server name or IP address as follows:
    $ mysql -u username -p -h 202.54.1.10 databasename < data.sql
    OR use hostname such as mysql.cyberciti.biz
    $ mysql -u username -p -h mysql.cyberciti.biz database-name < data.sql
    If you do not know the database name or database name is included in sql dump you can try out something as follows:
    $ mysql -u username -p -h 202.54.1.10 < data.sql
    To auto backup database, please read 10 ways to Automatically & Manually Backup MySQL Database , here is one example
    [root@sdc-d1-pangaea-devops1 ~]# vi /etc/crontab
    SHELL
    =/bin/bash
    PATH
    =/sbin:/bin:/usr/sbin:/usr/bin
    MAILTO
    =root
    HOME
    =/

    # For details see man 
    4 crontabs

    # Example of job definition:
    # .
    ---------------- minute (0 - 59)
    |  .------------- hour (0 - 23)
    |  |  .---------- day of month (1 - 31)
    |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr 
    |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
    |  |  |  |  |
    *  *  *  *  * user-name command to be executed
    59 23 * * tue root mysqldump -u root -proot123 jira > /export/home/web/dbbak/jira/jira_$(date +\%Y\%m\%d).sql
    This script will generate an backup file at 23:59 every Tue.
    Note
    The cron does not regonize `date +%Y%m%d`, so use $(date +\%Y\%m\%d) instead of it.


    -----------------------------------------------------
    Silence, the way to avoid many problems;
    Smile, the way to solve many problems;

    posted on 2012-03-21 17:43 Chan Chen 閱讀(286) 評論(0)  編輯  收藏 所屬分類: DB

    主站蜘蛛池模板: 曰批全过程免费视频在线观看无码 | 亚洲首页国产精品丝袜| 最近中文字幕国语免费完整 | 亚洲AV成人无码网站| 成人无遮挡裸免费视频在线观看| 亚洲第一香蕉视频| 8x8x华人永久免费视频| 亚洲系列中文字幕| 青草草色A免费观看在线| 亚洲AV无码成人专区| 一二三四影视在线看片免费| 亚洲愉拍一区二区三区| 好男人看视频免费2019中文 | 亚洲人成色777777在线观看| g0g0人体全免费高清大胆视频| 亚洲国产中文v高清在线观看| jzzjzz免费观看大片免费| 亚洲精品乱码久久久久久中文字幕 | 亚洲高清乱码午夜电影网| 亚洲日韩在线中文字幕综合 | 亚洲AV女人18毛片水真多| 国产精品视_精品国产免费| 永久免费无码日韩视频| 亚洲乱码无码永久不卡在线| 免费人成黄页在线观看日本| 亚洲综合免费视频| 免费激情视频网站| 国产激情久久久久影院老熟女免费 | 一本色道久久88—综合亚洲精品| 国产裸模视频免费区无码| 国产精品免费在线播放| 久久精品国产亚洲77777| 午夜视频在线在免费| 日韩一级片免费观看| 亚洲爱情岛论坛永久| 韩国欧洲一级毛片免费| 91免费在线视频| 亚洲成_人网站图片| 久久久亚洲精品蜜桃臀| 日日麻批免费40分钟日本的| 羞羞漫画登录页面免费|