-
mysql5.7
默认无密码登录 -
数据库
mysql
中的user
表的plugin
字段为auth_socket
# 查看所有的数据库 show databases; # 使用名为 mysql 的数据库 use mysql; # 查看 Host,User,plugin,authentication_string # authentication_string 对应加密之后的密码 select Host,User,plugin,authentication_string from user;
-
修改密码
update user set authentication_string=PASSWORD('password'),plugin='mysql_native_password' where User='root' and Host='localhost';
- 设置本机的
root
用户的密码为password
以及使用密码登录
- 设置本机的
-
刷新
FLUSH PRIVILEGES;
-
重新登录
03.`Ubuntu18.04`下`mysql`设置`root`用户密码登录
最新推荐文章于 2022-10-08 12:32:02 发布