最近在使用阿里云建站,远程连接MySql的时候遇到了很多问题,始终无法访问。
总结一下配置流程。
一、云主机安组
二、打开Iptables 3306d
三、Mysql角色赋权我的镜像是cent OS
iptables -I INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT service iptables save #保存iptables规则 netstat -an|grep 3306
1.查询的MySQL的的用户的
select host,user from mysql.user;
2.修改或新建用户
新建用户
grant all on *.* to 'memory'@'%' identified by '123456';
flush privileges;
修改用户update user set host = '%' where user = 'root';
Tip: all 表示所有权限 , *.*对应库名 这里默认所有库
memory 为用户名 @后的 '%' 代表所有IP地址均可访问
123456 为密码
四、连接Mysql