首页 > 解决方案 > mysqladmin:警告在命令行界面上使用密码可能不安全

问题描述

当我通过 SSH 连接到我的服务器时,我可以在不使用密码的情况下访问 MySQL 内容。所以当我打字的时候。

mysql -u root -p

它会提示我输入密码,但我可以输入任何内容并访问 MySQL 环境。

所以我尝试使用它来更改root密码,但它不起作用。

mysqladmin -u root password NEW_PASSWORD
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

这个我也试过...

use mysql;
update user set authentication_string=password('NEW_PASSWORD') where user='root';
​flush privileges;
​quit

那没有用。

和这个...

use mysql;
UPDATE mysql.user SET authentication_string = PASSWORD('NEW_PASSWORD') WHERE User = 'root' AND Host = 'localhost';
flush privileges;
​quit

这也没有奏效。

我看过这个教程https://www.techrepublic.com/article/how-to-set-change-and-recover-a-mysql-root-password/但我不明白为什么我应该硬编码我的根文本文件中的密码调用 ~/mysql-pwd 并将其放在我的服务器上。这听起来很疯狂。

(问题 1)将密码输入到服务器上的文本文件中真的安全吗?

我也在使用 winmin 来管理我的服务器,这很奇怪,这可能与我无法设置 root 密码的原因有关。

我的网站上有 SSL 证书,它们可以工作。但是,当我访问端口 10000 上的 webmin 环境时,firefox 无法识别 SSL 证书,我必须在 firefox 中添加一个例外,以便我可以看到我的 webmin 环境。

Firefox 使用 SSL 证书的 phpMyAdmin 没有任何问题。

(问题 2)那么这个 webmin 问题是否意味着我的 SSL 证书设置不正确,这在我 SSH 到服务器时会生效吗?

标签: mysqlsslsshpasswordsroot

解决方案


您只需要传递一个参数,--ssl-mode=required就可以建立安全的 shell 连接。我附上了没有/有的屏幕截图ssl-mode在此处输入图像描述


推荐阅读