您的位置:首页 > 数据库 > MySQL

Connection to mysql server on 10065 解决办法

2012-10-28 12:48 232 查看

Connection to mysql server on 10065 解决办法

远程访问linux上 的mysql一直不行,一直报 error 2003 : connection to mysql server on 10065 我是用的 Navicat for MySQL 登陆的



1.

修改方式1代码

改表法。

可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

mysql -u root -p123

mysql>use mysql;

mysql>update user set host = '%' where user = 'root';

改表法。

可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"

mysql -u root -p123

mysql>use mysql;

mysql>update user set host = '%' where user = 'root';



2. 进入mysql 授予表 数据库 权限



修改二代码

授权法。例如,你想 Ufinity

使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TOIDENTIFIED BY 'mypassword' WITH GRANT OPTION;

要及时生效 : FLUSH PRIVILEGES

如果你想允许用户kevin从ip为192.168.1.139的主机连接到mysql服务器,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON *.* TOIDENTIFIED BY 'mypassword' WITH GRANT OPTION;



3. 防火墙

最后方法代码

//关闭防火墙

service iptables stop





小结 :

其实1,2都是为了在mysql 的 mysql数据库中的 user表 里面有这样的记录

Sql代码

select Host ,User from user where User ='root' and Host ='%';

select Host ,User from user where User ='root' and Host ='%'; +------+------+

| Host | User |

+------+------+

| % | root |

+------+------+



意思是 以root 用户登陆 ,在局域网 中 所有的其他主机上都可以访问



最后实在不行 关闭防火墙。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐