zoukankan      html  css  js  c++  java
  • shell 读写远程数据库

    http://www.cnblogs.com/wangkangluo1/archive/2012/04/27/2472898.html

    利用Shell脚本实现远程MySQL自动查询

    目的:对定时任务对数据库的读写结果,通过定时脚本进行监控,实时数据通过浏览器或定时脚本展现

    yum install mysql

    mysql -u$user -p$pass -h$ip -P$port $db_name (注意 -u和用户名之间没有空格)

    http://www.jb51.net/article/39242.htm

    利用Shell脚本实现远程MySQL自动查询

    [root@hadoop1 bash_app]# vim mysql.domo.sh
    [root@hadoop1 bash_app]# chmod a+x mysql.domo.sh
    [root@hadoop1 bash_app]# ll -as
    总用量 8
    0 drwxr-xr-x 2 root root   26 12月 19 10:37 .
    4 drwxr-xr-x 5 root root 4096 12月 19 10:23 ..
    4 -rwxr-xr-x 1 root root  268 12月 19 10:37 mysql.domo.sh
    [root@hadoop1 bash_app]# ./mysql.domo.sh
    COUNT(1) 177242
    [root@hadoop1 bash_app]# ./mysql.domo.sh  >> db_sh_output
    [root@hadoop1 bash_app]# ./mysql.domo.sh  >> db_sh_output
    [root@hadoop1 bash_app]# cat db_sh_output
    COUNT(1) 177237
    COUNT(1) 177237
    [root@hadoop1 bash_app]# cat mysql.domo.sh
    HOST=sql.rds.iyuncs.com
    PORT=3306
    USER=teon
    PASS=t@j2I
    DB=dit_aid
    QUERY=`mysql -h$HOST -P$PORT -u$USER -p$PASS $DB << EOF
    SELECT COUNT(1)  FROM order WHERE   unix_timestamp(now())< expire_time;;
    exit
    EOF`
    echo $QUERY
    [root@hadoop1 bash_app]#

  • 相关阅读:
    Datasnap http用户验证
    Delphi 接口机制真相
    tfmxobject的序列化
    delphi md5算法
    delphi xe 窗体子控件实现窗体拖动
    Delphi笔记-自定义组件
    DELPHI RES资源文件使用方法
    Delphi中WebBrowser的使用技巧汇总
    Delphi XE调用第三方库Jni详细过程
    使用VLC进行屏幕广播
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8034840.html
Copyright © 2011-2022 走看看