欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 运维知识 > 数据库 >内容正文

数据库

shell脚本中执行mysql 语句,去除warning using a password on the command line interface can be insecure信息...

发布时间:2025/4/9 数据库 44 豆豆
生活随笔 收集整理的这篇文章主要介绍了 shell脚本中执行mysql 语句,去除warning using a password on the command line interface can be insecure信息... 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

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

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

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

 

使用示例:

cat count_tb_post_fourhour.sh #!/bin/bashcount_tb_post_fourhour_keys=`/usr/bin/mysql -hrr-bp1************3.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;" 2>&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 2917

 

转载于:https://www.cnblogs.com/weifeng1463/p/9330200.html

总结

以上是生活随笔为你收集整理的shell脚本中执行mysql 语句,去除warning using a password on the command line interface can be insecure信息...的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。