Linux下允许mysql远程访问

时间:2022-08-23 11:43:28

1.检测配置文件(/etc/mysql/mysql.conf.d/mysqld.cnf) 注释掉bind-address  = 127.0.0.1;作用是不再只允许本地访问;

2.重启mysql:/etc/init.d/mysql restart; 

3.GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '密码' WITH GRANT OPTION;

4.flush privileges;