报错:1130-host ... is not allowed to connect to this MySql server

解决方法:

1。 改表法。

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

mysql -u root -pvmwaremysql>use mysql;

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

mysql>select host, user from user;

2. 授权法。

例如,你想myuser使用mypassword从任何主机连接到mysql服务器的话。

GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘%‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

FLUSH   PRIVILEGES;

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

GRANT ALL PRIVILEGES ON *.* TO ‘myuser‘@‘192.168.1.3‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

FLUSH   PRIVILEGES;

如果你想允许用户myuser从ip为192.168.1.6的主机连接到mysql服务器的dk数据库,并使用mypassword作为密码

GRANT ALL PRIVILEGES ON dk.* TO ‘myuser‘@‘192.168.1.3‘ IDENTIFIED BY ‘mypassword‘ WITH GRANT OPTION;

FLUSH   PRIVILEGES;

我用的第一个方法,刚开始发现不行,在网上查了一下,少执行一个语句 mysql>FLUSH RIVILEGES 使修改生效.就可以了

另外一种方法,不过我没有亲自试过的,在csdn.net上找的,可以看一下.

在安装mysql的机器上运行:

1、d:\mysql\bin\>mysql   -h   localhost   -u   root //这样应该可以进入MySQL服务器

2、mysql>GRANT   ALL   PRIVILEGES   ON   *.*   TO   ‘root‘@‘%‘   WITH   GRANT   OPTION //赋予任何主机访问数据的权限

3、mysql>FLUSH   PRIVILEGES //修改生效

4、mysql>EXIT //退出MySQL服务器

这样就可以在其它任何的主机上以root身份登录啦!

转载至:

报错:1130-host ... is not allowed to connect to this MySql server 开放mysql远程连接 不使用localhost

时间: 2024-08-25 13:47:26

报错:1130-host ... is not allowed to connect to this MySql server的相关文章

ERROR 1130: Host ’...′ is not allowed to connect to this MySQL server

/******************************************************************** * ERROR 1130: Host ’...′ is not allowed to connect to this MySQL server * 说明: * 使用远程登录mysql,结果无法登录,记录一下解决方法. * * 2016-9-22 深圳 南山平山村 曾剑锋 ********************************************

解决ERROR 1130: Host '*.*.*.*' is not allowed to connect to this MySQL server 方法

简单点将阿里云ecs服务器内安装的mysql数据库里面的user表里面的Host为localhost的数据 将localhost改为% 如下图 上面那种方法 非常简单是我安装了phpmyadmin的方法 也可以用命令行 #用命令访问mysqlmysql -u root -p #使用mysql数据库use mysql; #查询当前用户情况,显示有2条记录,127.0.0.1:localhost:select host, user from user; #把localhost这条记录的host改为

MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server

今天安装MYSQL遇到MYSQL ERROR 1130: Host is not allowed to connect to this MySQL server, 试了很多办法都不行 skip-grant-tables 放在my.ini [mysqld] 1.更改任意主机登陆 mysql> use mysql; mysql> update user set host = '%' where user = 'root' and host='localhost'; 2.更新权限 mysql>

zbb20170811 mysql远程连接报错: Host * is not allowed to connect to this MySQL server,解决方法

解决此问题有以下2个方法: localhost改成% 1.进入mysql的BIN目录 注:root为管理员用户名,password为用户root的密码: mysql -u root -p password mysql>use mysql; mysql>update user set host ='%'where user ='root' and host ='localhost'; mysql>flush privileges; 注:这时候连接此服务器的mysql客户端需要重新启动下,然

err1130 Host'' is not allowed to connect to this MySQL server

执行sql报错 err1130  Host'' is not allowed to connect to this MySQL server 我的做法是自己建表,填数据,哈哈哈 一个小时以后..... 悲剧,建了表打不开,报同样的错. 一个小时以后......... 弄好了,我的做法是打开my.ini,在文件的最后添加一行"skip-grant-tables". 然后关机,开机,好了............. err1130 Host'' is not allowed to conne

mysql不能链接远程,报(Host '***.***.***.***' is not allowed to connect to this MySQL server)

Host '***.***.***.***' is not allowed to connect to this MySQL server 其中***...是本机公网ip; 解决办法: 首先看报错窗口. 经查阅,错误原因是:本地IP(xxx.xxx.xxx.xxx)没有访问远程数据库的权限. 于是下面开启本地IP(xxx.xxx.xxx.xxx)对远程mysql数据库的访问权限. 首先远程连接进入服务器,在cms中输入mysql -u root -p,然后回车,输入密码后回车进入mysql命令行

IT忍者神龟之mysql远程连接:ERROR 1130 (HY000): Host '*.*.*.*' is not allowed to connect to this MySQL server解决

安装完MySQL后,远程连接数据库的时候,出现 ERROR 1130 (HY000): Host '192.168.0.1' is not allowed to connect to this MySQL server提示信息,不能远程连接数据库.考虑可能是因为系统数据库mysql中user表中的host是localhost的原因,于是,我尝试把这个值改为自己服务器的ip,果然就好用了,不过用 mysql -u root -p命令就连不上数据库了,需要用mysql -h 服务器ip -u roo

Host is not allowed to connect to this MySQL server解决方法 可以访问局域网的数据库! 完美解决!

0. http://blog.csdn.net/flyyhz/article/details/77100243 1. 2. 3. 4. 5. 6. 7. 8. 9. 今天在Linux上面装完MySQL,却发现在本地登录可以,但是远程登录却报错Host is not allowed to connect to this mysql server,找了半天试了网上的一些方法都没有解决,最终在一篇文章里找到了解决方法,特意记录一下. 先说说这个错误,其实就是我们的MySQL不允许远程登录,所以远程登录

新部署的linux web服务器error Host ‘*.*.*.*’ is not allowed to connect to this MySQL server

最近上头交给我个任务,把WINDOWS平台下开发的网站,部署在LINUX环境上. 把mysql安装好了,所有表单都导入没问题,然后代码都放在tomcat下的webapps文件夹下了,主页 面可以正常显示,但有两个问题: 用户登录或注册的时候总是提示:Connecting to 192.168.2.109……(linux server的ip): 查看Tomcat  log文件catalina.out里有一堆 [WARN][2014-07-09 21:28:58,706][org.hibernate

PHP连接MySQL报错:SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2)

如下所示,PHP连接MySQL报错: SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket 'MySQL' (2) 测试代码如下: <?php try { $dsn = 'mysql:dbname=php-note;host=localhost;port=3306;charset=utf8'; $username = 'root'; $password = 'root'; new PDO( $dsn,