谁能告诉我为什么我可以登录作为一个root用户使用任何密码:
sudo mysql -u root -p
(我可以在密码提示中输入任何东西,它无论如何都会登录我)
My /root/.my.cnf
[client]
user=root
password=password123
这可能是因为"Unix套接字身份验证"插件在您的系统上默认是启用的。这似乎是Debian 9"Stretch"的例子。
在我的系统中,/etc/mysql/mariadb.conf.d/50-server.cnf
配置文件显示:
# * Unix socket authentication plugin is built-in since 10.0.22-6
#
# Needed so the root database user can authenticate without a password but
# only when running as the unix root user.
#
# Also available for other users if required.
# See https://mariadb.com/kb/en/unix_socket-authentication-plugin/