MYSQL添加远程用户或允许远程访问

时间:2022-05-27 14:42:10

使用 root 用户登录: 

使用 grant 语句:

1、添加一个用户admin并授权通过本地机(localhost)访问,密码"something"

mysql>grant all privileges on *.* to admin@localhost identified by 'something' with grant option;

2、添加一个用户admin并授权可从任何其它主机发起的访问(通配符%)

mysql>grant all privileges on *.* to admin@"%" identified by 'something' with grant option;

3、刷新权限列表

mysql>flush privileges;