前提:关闭防火墙
登录MySQL:
mysql -u root -p db;
执行以下命令开启远程访问限制:
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
flush privileges;
exit;
上面的‘%’是开启的所有IP 的,‘%’代替IP;
‘password’为远程数据库设置的访问密码。
前提:关闭防火墙
登录MySQL:
mysql -u root -p db;
执行以下命令开启远程访问限制:
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
flush privileges;
exit;
上面的‘%’是开启的所有IP 的,‘%’代替IP;
‘password’为远程数据库设置的访问密码。
本文标题:Centos下Mysql开启远程数据库访问
本文链接:https://www.haomeiwen.com/subject/nrbtfxtx.html
网友评论