1. 修改/etc/mysql/my.cnf
将bind-address =127.0.0.1注释掉
2. 重启mysql服务
service mysql restart
3. 授权用户
> grant all privileges on *.* to root@'%' identifies by 'password';
4. 加入不想让root被外界访问,那么创建一个用户,并授权
> insert into mysql.user(Host,User,Password) values("希望能访问的客户端IP","user",password("1234"));
> flush privileges;
>
grant all privileges on dbname.* to
user
@'client-ip' identifies by '
1234
';
5. 完工