<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

    主站蜘蛛池模板: 亚洲最大无码中文字幕| 亚洲欧洲日韩国产综合在线二区| 涩涩色中文综合亚洲| 4hu四虎最新免费地址| 亚洲天堂中文资源| 曰批全过程免费视频网址| 亚洲免费在线视频| 日本免费人成在线网站| 亚洲av专区无码观看精品天堂| 免费国产作爱视频网站| 国产成人精品亚洲日本在线 | 国产在线观看免费完整版中文版| 亚洲精品日韩一区二区小说| 日韩精品免费电影| 水蜜桃视频在线观看免费| 国产成人精品久久亚洲高清不卡 | 国产精品成人69XXX免费视频| 亚洲一区二区三区AV无码| 久久精品成人免费网站| 亚洲精品乱码久久久久久下载 | 亚洲三级中文字幕| 日韩免费视频播播| 51午夜精品免费视频| 国产成人亚洲综合色影视| 亚洲免费电影网站| 国产综合激情在线亚洲第一页| 亚洲福利在线播放| 久久久久久久岛国免费播放| 亚洲一区二区三区在线观看蜜桃| 国产在线19禁免费观看| 成人A片产无码免费视频在线观看| 亚洲精品mv在线观看| 国产精品免费_区二区三区观看| 国产精品玖玖美女张开腿让男人桶爽免费看 | a级片在线免费看| 亚洲一区二区三区高清视频| 日本高清免费aaaaa大片视频| 中文字幕看片在线a免费| 亚洲日本在线免费观看| 免费成人在线观看| 最近中文字幕完整版免费高清|