mysql 报错:Using a password on the command line interface can be insecure.

来自AI助手的总结
在命令行中直接输入密码账号信息不安全,可通过修改配置文件和使用交互式输入密码来解决。

意思:在命令行中直接输入密码账号信息是不安全的

这个是在MySQL5.6版本以后才出现的

出现场景

1、登录mysql的时候

#mysql -uroot -p数据库密码

Using a password on the command line interface can be insecure.

解决方式:

#mysql -uroot -p   回车,提示输入密码

2、在mysqldump中使用

#mysqldump -uroot -p你的密码 数据库名 > 存放位置 备份文件名.sql

Using a password on the command line interface can be insecure.

解决方法修改mysql配置文件

#vim /etc/my.conf

加入下面内容:

[mysqldump]
user=root
password=你的密码

然后重启服务器,修改mysqldump语句,去掉-uroot -p参数

#mysqldump 数据库名 > 存放位置 备份文件名.sql  

温馨提示: 本文最后更新于2025-03-02 00:11:39,某些文章具有时效性,若有错误或已失效,请在下方 留言或联系 蚂蚁官方
© 版权声明
THE END
喜欢就支持一下吧
点赞0赞赏 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容