方法二:使用mysql参数的方法

mysql -u$user -p$pass -D $db -e "select host from user;"

当然,可以通过将传参的方式来传递 -e 后面的语句。

使用示例:

 cat count_tb_post_fourhour.sh
#!/bin/bash count_tb_post_fourhour_keys=`/usr/bin/mysql -hrr-bp1************.mysql.rds.aliyuncs.com -uzh*****ng -p******** -D dee****hion -e "select count(1) from tb_post where created_at > date_sub(now(), interval 4 hour) and platformId = 1;" >& |grep -v "Warning: Using a password"|grep -v "count";` echo $count_tb_post_fourhour_keys [root@weifeng scripts]# sh count_tb_post_fourhour.sh

shell脚本中执行mysql 语句,去除warning using a password on the command line interface can be insecure信息的更多相关文章

  1. MySQL 5.6 Warning: Using a password on the command line interface can be insecure

    MySQL 5.6 在命令行输入密码,就会提示这些安全警告信息. Warning: Using a password on the command line interface can be inse ...

  2. MYSQL报警:Warning: Using a password on the command line interface can be insecure.

    问题描述:执行下面的语句,sql是执行成功了,但是出现了一个报警,报警看上去始终不舒服 mysql -hip -Pport -uuser -ppassword -e "use db;dele ...

  3. mysql处理警告 Warning: Using a password on the command line interface can be insecure.

    vim /etc/mysql/my.cnf [mysqldump] user=user_name password=password 格式: [只用密码的命令] user=用户名 password=密 ...

  4. mysql 5.7 Warning: Using a password on the command line interface can be insecure. 解决方案

    百度了好多,发现都是lunix环境下的,没有找到windows和OS 的,在lunix环境下的解决方案一般就是修改数据库配置文件 my.conf 在Windows 中是没有my.cnf 文件,而是叫做 ...

  5. 解决mysql连接输入密码提示Warning: Using a password on the command line interface can be insecure

    有时候客户端连接mysql需要指定密码时(如用zabbix监控mysql)5.6后数据库会给出个警告信息 mysql -uroot -pxxxx Warning: Using a password o ...

  6. MYSQL5.7脚本运行时出现[Warning] Using a password on the command line interface can be insecure

    MYSQL版本:5.7 在写linux脚本执行MYSQL命令的时候,如果使用 MYSQL="mysql -hlocalhost -P3306 -uroot -p666666" 登陆 ...

  7. mysql: "Warning: Using a password on the command line interface can be insecure." 解决方法

    错误重现: 命令行或者shell脚本中执行以下命令,如果您当前服务器mysql版本是大于5.6的,则会出现警告:Warning: Using a password on the command lin ...

  8. 【mysql报错】MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”

    MySQL5.7.27报错“[Warning] Using a password on the command line interface can be insecure.”在命令行使用密码不安全警 ...

  9. Mysql: [Warning] Using a password on the command line interface can be insecure

    mysql: [Warning] Using a password on the command line interface can be insecure MySQL 5.6 警告信息 comma ...

随机推荐

  1. [bzoj3244][noi2013]树的计数 题解

    UPD: 那位神牛的题解更新了,在这里. ------------------------------------------------------------------------------- ...

  2. SPOJ Time Limit Exceeded(高维前缀和)

    [题目链接] http://www.spoj.com/problems/TLE/en/ [题目大意] 给出n个数字c,求非负整数序列a,满足a<2^m 并且有a[i]&a[i+1]=0, ...

  3. BZOJ 3632 外太空旅行(最大团)

    [题目链接] http://www.lydsy.com/JudgeOnline/problem.php?id=3632 [题目大意] 求图中的最大团. [题解] 最大团问题是npc问题,因此可以考虑随 ...

  4. [xsy3241]暴风士兵

    题意:一个血量为$h$的人,它会被攻击$n$次,第$i$次有$p$的概率$-1$滴血(每次的$p$不同),问每次攻击后他的血量期望,强制在线 若一个人被扣了$i$滴血的概率为$p_i$,那么记多项式$ ...

  5. Android程序设计

    Android程序设计-1 要求安装 Android Stuidio 完成Hello World, 要求修改res目录中的内容,Hello World后要显示自己的学号,提交代码运行截图和码云Git链 ...

  6. mybatis批量插入:oracle和mysql的区别

    一.oracle批量插入 <insert id="save" parameterType="java.util.List"> insert into ...

  7. Codeforces Round #345 (Div. 2) E. Table Compression 并查集

    E. Table Compression 题目连接: http://www.codeforces.com/contest/651/problem/E Description Little Petya ...

  8. JavaScript 匹配字符串偶数位置的字符 及匹配 $ 符号

    已知一个字符串#####,现需要替换偶数位置的#为&. function replaceDemo(){ var s = "1#2#3#4#5#"; var regex = ...

  9. RequireJS 与 SeaJS 的异同

    相同之处 RequireJS 和 SeaJS 都是模块加载器,倡导的是一种模块化开发理念,核心价值是让 JavaScript 的模块化开发变得更简单自然. 不同之处 两者的区别如下: 定位有差异.Re ...

  10. Delphi XE10下用FireDAC与SQLite连接要注意的问题 转

      Delphi在XE的版本上,已经实现了安卓与苹果的移动跨平台,因此只需要一份代码,就可以统领两种手机平台,确实是一种高效的做法和节约的策略. 用Delphi XE7连接SQLite,主流使用Fir ...