<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 閱讀(285) 評論(0)  編輯  收藏 所屬分類: DB

    主站蜘蛛池模板: 亚洲精品无码人妻无码| 亚洲成在人线中文字幕| 免费观看又污又黄在线观看| 成人国产mv免费视频| 亚洲成在人线在线播放无码| 成年女人免费视频播放77777| 亚洲乱码在线观看| 四虎免费永久在线播放| 国产VA免费精品高清在线| 亚洲春色在线视频| 免费人成视频在线观看网站| 亚洲免费闲人蜜桃| 国产精品免费看香蕉| 亚洲免费无码在线| 亚洲视频日韩视频| 成年午夜视频免费观看视频| 激情小说亚洲色图| 亚洲中文字幕久久精品无码喷水 | 国产网站在线免费观看| 亚洲精华液一二三产区| 亚洲精品视频久久久| 久久精品成人免费看| 亚洲二区在线视频| 国产乱色精品成人免费视频| 99在线视频免费观看| 亚洲国产精品成人久久久| 日韩精品成人亚洲专区| 午夜免费啪视频在线观看| 77777午夜亚洲| 亚洲综合另类小说色区色噜噜| 99爱视频99爱在线观看免费| 亚洲中文精品久久久久久不卡| 亚洲无码黄色网址| 97人妻无码一区二区精品免费| 欧美日韩亚洲精品| 亚洲国产女人aaa毛片在线| 国产裸模视频免费区无码| 日韩精品人妻系列无码专区免费| 亚洲区日韩精品中文字幕| 久久99国产亚洲精品观看| 免费精品一区二区三区在线观看|