Title Image

Blog

设置MySQL远程链接

  |   Geek   |   No comment


//更改mysql自身数据库‘mysql’
use mysql;
select host,user,password from user;

//%允许任何主机连接本数据库,
grant all privileges on *.* to 'root'@'%' identified by 'XXXXXXXXX' with grant option;

//重置mysql服务;
flush privileges;

//退出mysql
exit;

//如果有防火墙,确保打开3306端口
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

//开关防火墙(重启)
chkconfig iptables on
chkconfig iptables off

//临时开关防火墙
service iptables start
service iptables stop

//连接方命令:
mysql -u root -p -h 地址

No Comments

Post A Comment