讓外部電腦可以訪問伺服器上面的mysql資料庫
阿新 • • 發佈:2018-12-22
①mysql中user表新增一行root為%、
use mysql;
insert into user values('%', 'root', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '0', '0', '0', '0', 'mysql_native_password', '*9DD87DBB130018FC7FB9B64017DE541379884BD5', 'N', '2017-10-20 08:51:13', NULL, 'N');
select * from mysql.user;
grant all privileges on *.* to 'root'@'%' identified by 'huiyuanlianghua' with grant option;
flush privileges;
②grant賦值許可權 也可以直接修改user表中的許可權
③伺服器安全組規則中,要開放mysql的3306埠,防火牆中也要新建入規則過濾3306埠
insert into user values('%', 'root', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', 'Y', '', '', '', '', '0', '0', '0', '0', 'mysql_native_password', '*9DD87DBB130018FC7FB9B64017DE541379884BD5', 'N', '2017-10-20 08:51:13', NULL, 'N');
select * from mysql.user;
grant all privileges on *.* to 'root'@'%' identified by 'huiyuanlianghua' with grant option;
flush privileges;
③伺服器安全組規則中,要開放mysql的3306埠,防火牆中也要新建入規則過濾3306埠