我需要对新服务器运行自动检查。其中一项检查是检测是否设置了用户(或 root
)密码。但是..
mysql> SELECT host, user, password FROM mysql.user;
ERROR 1054 (42S22): Unknown column 'password' in 'field list'
服务器版本:5.7.18-0ubuntu0.17.04.1 (Ubuntu)
最佳答案
MySQL 5.7 或更高版本在 mysql.user 表中没有名为 password 的列。 MySQL 5.7 或更高版本改为使用列 authentication_string。
所以你的查询应该是:
SELECT host, user, authentication_string FROM mysql.user
关于mysql - 如何检查mysql中是否设置了用户密码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43833292/