mysql开启远程链接

1. mysql -u root -p root  连接到mysql服务

1.1开启远程链接的方法:

a. 查看当前数据库 show databases;

b.切换到指定的数据库 use mysql; use +库名

c.授权

select * from user \G;

update user set host='%' where Host="localhost" and User="root"; %代表所有机器可连接

flush privileges(刷新权限)或者重启mysql服务 service mysqld  restart

d.防火墙放行端口

编辑vim /etc/sysconfig/iptables 复制一行 将8080改为数据库端口3306

在重新启动防火墙

service iptables restart

service iptables status

发布了30 篇原创文章 · 获赞 13 · 访问量 9998

猜你喜欢

转载自blog.csdn.net/chushudu/article/details/81940406