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 ...
随机推荐
- java循环遍历类属性 get 和set值方法
//遍历sqspb类 成员为String类型 属性为空的全部替换为"/"Field[] fields = sqspb.getClass().getDeclaredFields(); ...
- spark2.1:使用df.select(when(a===b,1).otherwise(0))替换(case when a==b then 1 else 0 end)
最近工作中把一些sql.sh脚本执行hive的语句升级为spark2.1版本,其中遇到将case when 替换为scala操作df的方式实现的问题: 代码数据: scala> import o ...
- Android:触屏事件
Android触屏事件包含两种: 1)屏幕触屏事件:重写onTouchEvent(MotionEvent event): 2)控件触屏事件:给控件注册触屏事件,setOnTouchEventListe ...
- [转]最常用的15大Eclipse开发快捷键技巧
作者:Java我人生(陈磊兴) 原文出处http://blog.csdn.net/chenleixing/article/details/44600587 做Java开发的,经常会用Eclipse ...
- javascript 函数的4种调用方式与 this(上下文)的指向
前言:这是笔者学习之后自己的理解与整理.如果有错误或者疑问的地方,请大家指正,我会持续更新! javascript中作用域链和this(上下文)的指向是很容易混淆的,简单的说就是: 作用域链取决于函数 ...
- java中的数组概念
数组的定义形式: 动态初始化方式: 1.声明并开辟数组 String str[]=new String[3];//3表示数组的长度 2.分布完成 String str[]=null; str=new ...
- java中关于&、&&、|、||之间的区别和运算
关于&.&&.|.||之间的区别和运算 在逻辑运算中: 普通与&:要判断所有的判断的条件 短路与&&:如果前面一个判断条件出现false,则后续的判断条 ...
- [LeetCode] Maximum Sum of 3 Non-Overlapping Subarrays 三个非重叠子数组的最大和
In a given array nums of positive integers, find three non-overlapping subarrays with maximum sum. E ...
- [LeetCode] Binary Tree Tilt 二叉树的坡度
Given a binary tree, return the tilt of the whole tree. The tilt of a tree node is defined as the ab ...
- 【django小练习之主机管理界面】
需求: 利用django,js,bootstrap等实现登录,主机管理等操作. 实现截图 登录界面 主机界面,添加及编辑 部门管理界面 代码实现 目录层级 settings.py "&quo ...