MySQL5.6 Using a password on the command line interface can be insecure解决方法;

来源:互联网 发布:华为总是停用移动数据 编辑:程序博客网 时间:2024/06/06 22:39

1.最近把MySQL从5.5升到5.6以后,mysqldump居然不好用了,提示:

 代码如下

复制代码

[root@qttc ~]# /usr/local/mysql/bin/mysqldump  -uroot -proot db > bak.sql
Warning: Using a password on the command line interface can be insecure.

翻译过来是:在命令行界面上使用密码可以是不安全的;

这让人有点郁闷,5.5用的1直都很爽,到5.6居然说命令行方式写密码不安全?那密码写哪呢?

在官网文档找到了缘由,大家可以点击这里看看:

1.官方网址:http://dev.mysql.com/doc/refman/5.1/en/password-security-user.html

MySQL users shoulduse the following guidelines to keep passwords secure.

   When you run a client program to connect to the MySQL server, it is inadvisableto specify your password in a way that exposes it to discovery by other users.The methods you can use to specify your password when you run client programsare listed here, along with an assessment of the risks of each method. Inshort, the safest methods are to have the client program prompt for thepassword or to specify the password in a properly protected option file.

翻译过来大意是在命令行下如果要使用密码可以在执行命令后的提示输入里输入密码,或者在指定的安全文件内指定密码;那安全文件时哪个呢?文档对此给出了答案:

Store your passwordin an option file. For example, on Unix, you can list your password in the[client] section of the .my.cnf file in your home directory:

可以在my.cnf内指定,于是打开我的my.cnf,在[mysqldump]下增加:

 代码如下

复制代码

user=root
password=root

文中说的在[client]下面加也可以,但那样就所有块的操作都能共享了,所以生产环境上为了安全还是尽量分开;保存退出再dump就ok了;

 代码如下

复制代码

[root@qttc ~]# /usr/local/mysql/bin/mysqldump db > bak.sql
[root@qttc ~]#

MySQL 5.6 警告信息 command line interface can be insecure 修复

在命令行输入密码,就会提示这些安全警告信息;

Warning: Using apassword on the command line interface can be insecure.

注:mysql -u root -pPASSWORD 或 mysqldump -u root -pPASSWORD 都会输出这样的警告信息.

1.针对mysql:

mysql -u root -pPASSWORD改成mysql -u root -p 在输入密码即可.

2.mysqldump就比较麻烦了,通常都写在scripts脚本中;

解决方法:

对于mysqldump 要如何避免出现(Warning:Using a password on the command line interface can be insecure.) 警告信息呢?

vim /etc/mysql/my.cnf

[mysqldump]

user=your_backup_user_name

password=your_backup_password

修改完配置文件后, 只需要执行mysqldump 脚本就可以了;备份脚本中不需要涉及用户名密码相关信息;

 


0 0
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 线性回归r2大于1怎么办 小米手环2不计步怎么办 gta5单机没血了怎么办 锅把手铆钉松了怎么办 蝴蝶刀铆钉松了怎么办? 孕早期吃了田螺怎么办 误吃田螺的尾巴怎么办 螺母滑丝怎么办取下来 轮胎螺丝滑丝了怎么办 固定孔螺丝滑丝怎么办 小螺丝拧不出来怎么办 小螺丝拧不下来怎么办 螺丝拧的太紧怎么办 大螺母拧不下来怎么办 大螺帽拧不出来怎么办 十字螺丝滑丝了怎么办 六角螺母拧圆了怎么办 饺子冻在盘子上怎么办 煮熟的饺子坨了怎么办 六角螺丝拧圆了怎么办 长杆螺丝滑丝了怎么办 起泡器不起泡了怎么办 不喂母乳涨奶怎么办 螺丝和螺母跟转怎么办 六棱螺丝滑丝了怎么办 苹果6螺丝滑牙了怎么办 外六角螺丝圆了怎么办 小螺丝拧花了怎么办 老人退伍证丢了怎么办 狗狗又拉又吐怎么办 孕妇吃了马兰头怎么办 怀孕吃了马兰头怎么办 吃了茭白和豆腐怎么办 电气焊加工怎么办环评 手上皮肤干燥起皮怎么办 脸上起皮怎么办还痒痒 店铺4周被释放了怎么办 炫舞账号忘了怎么办 椎基底供血不足怎么办? 脑动脉供血不足怎么办 颈椎引起的脑供血不足怎么办