mysql从5.6版本开始,如果是命令行直接出现了数据库连接密码就会有以下警告:

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

如用mysql -uroot -proot -e 'show varibles;'或echo “show full processlist "|mysql -uroot -p`cat /root/passwd`;在返回查询的结果中的第一行都有mysql: [Warning] Using a password on the command line interface can be insecure.

  如何去掉这行报警呢!其它很简单,我们弄清了它是怎么出现的就好解决了,你可以试着用管道只显示最后一行。如mysql -uroot -proot -e 'show varibles‘ | tail -n1  但好像不起作用,为什么呢!因为它是标准错误输出。加上 2>/dev/null 就可以了。

  mysql -uroot -proot -e 'show varibles’ 2>/dev/nul

相关文章:

  • 2021-10-28
  • 2021-06-24
  • 2021-08-11
  • 2021-11-17
  • 2021-10-01
  • 2021-11-06
  • 2021-06-11
  • 2021-11-05
猜你喜欢
  • 2021-06-25
  • 2021-10-07
  • 2021-11-02
  • 2021-11-05
  • 2021-12-30
  • 2021-11-14
相关资源
相似解决方案