<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

    主站蜘蛛池模板: 亚洲日韩国产精品乱-久| 四虎影库久免费视频| 亚洲精品国产高清嫩草影院| 亚洲日韩乱码久久久久久| a级毛片免费高清毛片视频| 久久夜色精品国产噜噜亚洲a| 在线看片免费人成视频福利| 无人影院手机版在线观看免费 | 日韩亚洲人成在线综合日本| 亚洲色WWW成人永久网址| 亚洲av中文无码乱人伦在线r▽ | 亚洲国产高清精品线久久| 亚洲a∨国产av综合av下载| 亚洲日本视频在线观看| 久久久久久一品道精品免费看| 好男人www免费高清视频在线| 亚洲色图激情文学| 国产免费拔擦拔擦8x| 国产精品一区二区三区免费| 曰曰鲁夜夜免费播放视频 | 国产jizzjizz视频免费看| 老司机午夜性生免费福利| 免费福利视频导航| 亚洲va无码va在线va天堂| 最近中文字幕高清免费中文字幕mv| 国产精品亚洲不卡一区二区三区| 久草免费福利在线| 免费午夜爽爽爽WWW视频十八禁| 亚洲一区二区三区高清| 久久精品免费网站网| 亚洲图片在线观看| 成全视频在线观看免费| 亚洲第一精品电影网| 日韩免费视频观看| 亚洲AV无码乱码麻豆精品国产| 日本在线看片免费| 亚洲七久久之综合七久久| 久久夜色精品国产亚洲av| 理论片在线观看免费| 亚洲日本香蕉视频观看视频| 亚洲国产av一区二区三区|