MySQL8.0以上版本开启远程访问权限
- 登录
- 命令
- create user 'root'@'%' identified by 'r'; # root为用户名,%需要访问的机器的IP,r是密码
- grant all on . to 'root'@'%'; # root为用户名,%需要访问的机器的IP
- alter user 'root'@'%' identified with mysql_native_password by 'r'; # root为用户名,%需要访问的机器的IP,r是密码
- flush privileges; # 刷新权限,让设置生效