mysql -uroot -p
grant all on *.* to baimoc@'%' identified by '123456' with grant option;
flush privileges;
baimoc这个用户不一定要存在(可以按需要去取名),%表示可任意ip访问
use mysql;
select user, host from user;
如果用户baimoc的host为%,则表示可远程ip访问
skip-networking #注释掉 ,它是屏蔽掉一切TCP/IP连接 bind-address = 127.0.0.1 #注释掉 , 它指定只能本地连接
$ mysql -h xxx.xxx.xxx.xxx -P 3306 -u admin -p123456
如果报错:ERROR 2003 (HY000): Can’t connect to MySQL server on ‘xxx.xxx.xxx.xxx’ (113)
/etc/rc.d/init.d/iptables stop
service mysql restart