linux mysql解决远程连接问题

1.开启mysql 

linux mysql解决远程连接问题

2.查看当前哪些用户可以访问

进入mysql shell

show databases;

use mysql ;

select host, user ,password from user;

linux mysql解决远程连接问题

3.修改配置,在user表中添加所有用户可以访问本mysql服务

命令: grant all privileges on . to 'root'@'%' identified by '123456' with grant option;

'root'@'%' : % 表示所有主机

root 表示主机上使用的用户

123456 表示用户所使用的密码

linux mysql解决远程连接问题

4.刷新生效

flush privileges;

检查更新

select host, user ,password from user;

linux mysql解决远程连接问题

% 所有主机

root 主机上使用的用户

*6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 123456 加密后的数据

5. 关闭防火墙

/etc/init.d/iptables stop

chkconfig iptables off(开机不自动启动 chkconfig iptables on开机自启)

6.远程连接

linux mysql解决远程连接问题

linux mysql解决远程连接问题