您当前的位置: 首页 >  sql

Dongguo丶

暂无认证

  • 0浏览

    0关注

    472博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

解决远程连接mysql错误1130代码的方法

Dongguo丶 发布时间:2018-03-18 21:11:21 ,浏览量:0

今天在用远程连接Mysql服务器的数据库,不管怎么弄都是连接不到,错误代码是1130,ERROR 1130: Host 192.168.2.159 is not allowed to connect to this MySQL server 猜想是无法给远程连接的用户权限问题。结果这样子操作mysql库,即可解决。

在本机用IP:127.0.0.1登入mysql后,更改 “mysql” 数据库里的 “user” 表里的 “host” 项,从”localhost”改称’%’。。

mysql -u root -p mysql>use mysql; mysql>select ‘host’ from user where user=‘root’; mysql>update user set host = ‘%’ where user =‘root’; mysql>flush privileges; mysql>select ‘host’ from user where user=‘root’; 第一句是以权限用户root登录 第二句:选择mysql库 第三句:查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称) 第四句:修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址 第五句:刷新MySQL的系统权限相关表 第六句:再重新查看user表时,有修改。。 重起mysql服务即可完成。

一、通过MySQL-Front或mysql administrator连接mysql的时候发生的这个错误 ERROR 1130: Host .***.***. is not allowed to connect to this MySQL server 说明所连接的用户帐号没有远程连接的权限,只能在本机(localhost)登录。 需更改 mysql 数据库里的 user表里的 host项 把localhost改称% 首先按下面的步骤登录Mysql服务器 登录mysql需要切换到dos下的mysql的bin目录,进行如下操作: 语法格式:mysql -h host_name -u user_name -p password (本机的话-h 和host_name可省) 例如: C:\program files\mysql\mysql server 5.0\bin>mysql -u root -p Enter password:****** 先输入用户名和密码登陆要求(-p),回车后等出现"Enter password:",再输入密码回车,这样就可以 成功登陆mysql,否则将会登陆失败。 登陆成功后会显示如下信息及Mysql标识符: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 1 to server version: 5.0.1-nt Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer. mysql>

关注
打赏
1638062488
查看更多评论
立即登录/注册

微信扫码登录

0.0384s