Linux下MySQL远程连接

Linux下的MySQL远程连接设置
Linux版本:centos6.5版本
MySQL版本:5.5

因为MySQL在刚刚安装完成之后,默认不支持远程连接,所以需要授权!
授权法:

grant all privileges on*.* to '用户名'@'%' identified by '登录密码' with grant option;

其中 all privileges 为权限 *.*代表着所有库和所有表 用户名 和登陆密码
为登陆数据库的name和password %代表允许所有ip访问 最后需要 flush privileges;刷新 亲测有效!!!

另外还有一种方法
命令:
(查看系统的权限表)

 `use MySQL; 		
select host,user from user
 update user set host='%' where root = 'user'    (user表默认为localhost连接不能远程)

使用update更改 不过这种方法没有使用过。如果感兴趣,可以试一下!!!`

你可能感兴趣的:(Linux)