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

    主站蜘蛛池模板: 久久久久亚洲AV无码永不| 久久亚洲国产精品五月天| 精品无码一区二区三区亚洲桃色| xxxxxx日本处大片免费看| 精品四虎免费观看国产高清午夜| 亚洲人成影院在线观看 | 亚洲中文字幕久久无码| 久久久久久国产a免费观看黄色大片| 国产精品视频免费一区二区| 成人爱做日本视频免费| 77777午夜亚洲| 久久99毛片免费观看不卡| 国产亚洲AV夜间福利香蕉149| 一级毛片免费不卡| 亚洲国产美女精品久久久久∴| 亚洲欧美国产欧美色欲| 日本黄色免费观看| 特级av毛片免费观看| 亚洲中文字幕无码永久在线| a级成人免费毛片完整版| 亚洲国产一区二区三区青草影视 | 亚洲精品在线免费观看| 国产大片免费网站不卡美女| 国产成人精品日本亚洲18图| 浮力影院第一页小视频国产在线观看免费 | 亚洲 自拍 另类小说综合图区| 亚洲欧洲综合在线| 国产精品成人免费一区二区| 精品国产_亚洲人成在线| 99久在线国内在线播放免费观看| 亚洲天堂一区在线| 国产一级淫片视频免费看| 中文在线免费观看| 亚洲午夜福利精品久久| 无码精品人妻一区二区三区免费看| 久99精品视频在线观看婷亚洲片国产一区一级在线 | 中文字幕人成人乱码亚洲电影| 久久免费观看国产精品88av| 国产亚洲中文日本不卡二区 | 国产男女性潮高清免费网站| 亚洲综合色区中文字幕|