MySql8新增用户

Mysql的版本是8.0.18,其他版本未验证

1. 新增用户

// 切换数据库到mysql
mysql> use mysql
// testUser:新增的用户名;localhost:仅本地访问,也可以是%(不限制)或者ip地址;123456:用户密码
mysql> create user 'testUser'@'localhost' identified by '123456';

MySql8新增用户

2. 刷新权限

mysql> flush privileges;

MySql8新增用户

3. 赋予权限

mysql> grant all privileges on *.* to 'testUser'@'localhost' with grant option;

MySql8新增用户

4. 查看

mysql> select Host,User from user;

MySql8新增用户

猜你喜欢

转载自blog.51cto.com/1197822/2481013