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

意思就是说,密码露了,不安全。

我们执行脚本的时候,最好可以把这个东西干掉,否则一直弹弹弹,烦的要死。

于是我们可以:

 

1. 建立一个文件,存放用户名、密码

touch /etc/my.password

然后写入下列内容:

[client]
user=root
password=密码

 

2. 登录时,不使用-u -p来指定,使用--defaults-extra-file=/etc/my.password来指定配置文件进行登录,就可以消掉那行warning了。

mysql --defaults-extra-file=/etc/my.password


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM