Mysql数据库连接报错!1130:host XXX is not allowed to connect to this mysql server
我猜想是可能是连接的用户权限问题。结果这样子操作mysql库,可以解决此问题。在本机登入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>
标识符"mysql>",当你看到这个出现在窗口的最左边的顶格时,这就是告诉你,你可以输入命令进行操作了。
mysql> \s 查看版本信息 mysql> \q or mysql> quit 退出mysql数据库服务器 mysql> \h or mysql> help 查看帮助(其他的数据库服务器相关命令)
二、登录成功后可通过以下步骤对用户进行权限更改
mysql>use mysql;
mysql>update user set host = '%' where user ='root';
mysql>flush privileges;
mysql>select 'host','user' from user where user='root';
mysql>quit
退出后会回到DOS正常的提示符状态,此时可以通过远程连接Mysql了!
三、另一种方式: 授权法。例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。
GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'%' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 如果你想允许用户myuser从ip为192.168.1.3的主机连接到mysql服务器,并使用mypassword作为密码 GRANT ALL PRIVILEGES ON *.* TO 'myuser'@'192.168.1.3' IDENTIFIED BY 'mypassword' WITH GRANT OPTION; 我的mysql.user里root用户的host果然是localhost,先用改表法给localhost改成“%”,还是不行,仍然报1130的错误,又按“从任何主机连接到mysql服务器”方法授权,还是报一样的错,最后给自己的ip授权之后,终于登录上了。
mysql的ERROR 1045 在上面情况后如再出现客户段1045可在服务器执行如下
UPDATE user SET Password=PASSWORD('123456') where USER='myuser'; FLUSH PRIVILEGES;
Mysql数据库连接报错!1130:host XXX is not allowed to connect to this mysql server的更多相关文章
- 用Navicat Premium 连接mysql数据库时报错 -- 1130 Host xxxx is not allowed to connect to this MySQL server
用Navicat Premium 连接mysql数据库时报错 报错原因:此时的MySQL默认不能远程连接. 解决方案:修改MySQL配置 具体步骤: 1.登陆服务器,进入数据库 mysql -uroo ...
- ERROR 1130: Host xxx is not allowed to connect to this MySQL server
在使用MySQL-Front连接mysql的时候发生的这个错误 ERROR 1130: Host xxx is not allowed to connect to this MySQL server ...
- 连接远程数据库时出现 SSH: expected key exchange group packet from server / 2003 - Can't connect to MySQL server on 'XXX' (10038) / 1130 - Host 'XXX' is not allowed to connect to this MySQL server
昨天在自己的远程服务器上玩,把系统重装了.新装了MySQL,在本地用navicat连接的时候出了几个小问题. 问题一:SSH: expected key exchange group packet f ...
- 连接数据库报错:1130-Host 'xxx' is not allowed to connect to this MySQL server解决
出现这个问题的同学都很奇怪,为啥用localhost就可以连接上,但是使用本地ip就不行.出现这个问题的原因就是mysql未开启mysql远程访问权限导致. 这时候我们就用cmd去访问下你的mysql ...
- 解决MySql报错:1130 - Host 'xxx' is not allowed to connect to this MySQL server的方法
发现问题 使用Navicat连接MySql数据库时,未能成功,提示信息如下图: 这个错误提示已经很明确了,"不允许主机'desktop-teat9ob'连接到此mysql服务器", ...
- 远程连接mysql报错【1130 -host 'localhost' is not allowed to connect to this mysql server】
远程连接mysql时包如下错误: 1130 -host 'localhost' is not allowed to connect to this mysql server 解决办法 本地用root账 ...
- mysql报错:1130 -host 'localhost' is not allowed to connect to this mysql server
错误提示:1130 -host 'localhost' is not allowed to connect to this mysql server 原因:手贱把mysql数据库系统中mysql数据库 ...
- 错误号码1130:Host 'XXX' is not allowed to connect to this MySQL server
今天在linux机器上装了一个mysql,想通过sqlyog远程连接过去,发生了:错误号码1130:Host 'XXX' is not allowed to connect to this MySQL ...
- 解决服务器连接错误Host ‘XXX’ is not allowed to connect to this MySQL server
这段时间在研究火车头的入库教程,在“配置登陆信息和数据库(mysql)”连接中,出现“服务器连接错误Host 'XXX' is not allowed to connect to this MySQL ...
- Host 'xxx' is not allowed to connect to this MySQL server.
mysql开启远程连接 今天在服务器安装了mysql,准备用mysqlguitools远程登录的时候出错,提示:Host 'xxx' is not allowed to connect to this ...
随机推荐
- 浅谈Web网站的架构演变过程
前言 我们以javaweb为例,来搭建一个简单的电商系统,看看这个系统可以如何一步步演变. 该系统具备的功能: 用户模块:用户注册和管理 商品模块:商品展示和管理 交易模块:创建交易和管理 阶 ...
- 2017年Unity游戏开发视频教程(入门到精通)
本文是我发布的一个Unity游戏开发的学习目录,以后我会持续发布一系列的游戏开发教程,都会更新在这个页面上,适合人群有下面的几种: 想要做独立游戏的人 想要找游戏开发相关工作的人 对游戏开发感兴趣的人 ...
- 记录java/javascript让浮点数显示两位小数的方法
参考:http://www.jb51.net/article/46010.htm 另,如果只是要在页面层展示的时候,显示为两位小数,也可以直接改前端js代码. item.turnoverRate = ...
- sqli-lab 第一题 单引号 error based single quotes
一.第一次见面 1.初识 http://localhost/Less-1/ 提示输入id,因此访问http://localhost/Less-1/?id=1 可以继续测试id=2.3.4等的情况,会输 ...
- .NET Core2.0+MVC 用Redis/Memory+cookie实现的sso单点登录
之前发布过使用session+cookie实现的单点登录,博主个人用的很不舒服,为什么呢,博主自己测试的时候,通过修改host的方法,在本机发布了三个站点,但是,经过测试,发现,三个站点使用的sess ...
- java.sql.SQLException: null, message from server: "Host '192.168.126.100' is not allowed to connect to this MySQL server"
- 剥掉层层外衣后的RPC是什么样子的?
RPC,全称为Remote Procedure Call(远程过程调用).通俗一点讲就是在本地调用远程服务器上的功能.实现远程调用至少需要满足以下几个条件: 1.网络通信 2.序列化与反序列化 3.反 ...
- [SDOI 2011]黑白棋
Description 题库链接 给出一个 \(1\times n\) 的棋盘,棋盘上有 \(k\) 个棋子,一半是黑色,一半是白色.最左边是白色棋子,最右边是黑色棋子,相邻的棋子颜色不同. 小 \( ...
- [ZJOI2009]染色游戏
Description 一共n × m 个硬币,摆成n × m 的长方形.dongdong 和xixi 玩一个游戏, 每次可以选择一个连通块,并把其中的硬币全部翻转,但是需要满足存在一个 硬币属于这个 ...
- 2015 多校联赛 ——HDU5353(构造)
Each soda has some candies in their hand. And they want to make the number of candies the same by do ...