mysql允许远程特定ip访问
1.登录
mysql -u root -p
之后输入密码登录
2.权限设置 添加远程ip访问权限
GRANT ALL PRIVILEGES ON *.* TO 'root'@'172.23.101.131' IDENTIFIED BY 'lxw@123' WITH GRANT OPTION;
flush privileges;
172.23.101.131是允许远程访问的IP的值
MySQL 8.0
CREATE USER 'test'@'172.23.101.131' IDENTIFIED WITH mysql_native_password BY 'lxw@123';
GRANT ALL PRIVILEGES ON *.* TO 'test'@'172.23.101.131';
flush privileges;
如果需要指定权限,就将ALL改为SELECT DELETE UPDATE INSERT等四种权限任选即可
如果创建错了,可以使用下面语句删除用户:
drop user '用户名'@'ip';