为什么我可以使用任何密码登录mysql root?

为什么我可以使用任何密码登录mysql root?,mysql,Mysql,有人能解释一下为什么我可以使用以下密码以root用户身份登录: sudomysql-u root-p (我可以在密码提示中键入任何内容,但它仍会让我登录) My/root/.My.cnf [client] user=root password=password123 这可能是因为系统默认启用了“Unix套接字身份验证”插件。例如,Debian9“Stretch”就是这样 在我的系统上,/etc/mysql/mariadb.conf.d/50 server.cnf配置文件说明: # * Unix

有人能解释一下为什么我可以使用以下密码以root用户身份登录:

sudomysql-u root-p

(我可以在密码提示中键入任何内容,但它仍会让我登录)

My
/root/.My.cnf

[client]
user=root
password=password123
这可能是因为系统默认启用了“Unix套接字身份验证”插件。例如,Debian9“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/