mysql -u root -p

mysql>use mysql;

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

mysql>flush privileges;

mysql> use mysql

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> update user set password=password('root123') where user='root' and host='localhost'

-> ;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

mysql> select 'host' from user where user='root'

-> ;

+------+

| host |

+------+

| host |

| host |

| host |

| host |

+------+

4 rows in set (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@‘%’ IDENTIFIED BY ‘root123’ WITH GRANT OPTION;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%’ IDENTIFIED BY ‘root123’ WITH GRANT OPTION' at line 1

mysql> grant all privileges on *.* to 'root'@'%' identified by 'root123' with grant option;

Query OK, 0 rows affected (0.00 sec)

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

-> flush privileges;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'flush privileges' at line 2

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> select host from user where user='root'

-> ;

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

| host                  |

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

| %                     |

| 127.0.0.1             |

| ::1                   |

| localhost             |

| localhost.localdomain |

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

5 rows in set (0.00 sec)

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

ERROR 1062 (23000): Duplicate entry '%-root' for key 'PRIMARY'

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql> select host,user from user where user='root'

-> ;

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

| host                  | user |

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

| %                     | root |

| 127.0.0.1             | root |

| ::1                   | root |

| localhost             | root |

| localhost.localdomain | root |

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

5 rows in set (0.00 sec)

mysql>

mysql远程连接 Host * is not allowed to connect to this MySQL server的更多相关文章

  1. mysql远程连接 Host * is not allowed to connect to this MySQL server(第一次配置好lnmp环境)

    1.第一次在linux上搭建好mysql,本机windows远程链接报错Host * is not allowed to connect to this MySQL server 2.原因:mysql ...

  2. 转:mysql远程连接 Host * is not allowed to connect to this MySQL server

    在本机登入mysql后,更改"mysql"数据库里的"user"表里的"host"项,从"localhost"改为'%' ...

  3. mySql 远程连接(is not allowed to connect to this MySQL server)

    如果你想连接你的mysql的时候发生这个错误: ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL serve ...

  4. 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-gra ...

  5. ***远程连接MYSQL提示1130 - Host is not allowed to connect to this MySQL server

    如果你想连接你的mysql的时候发生这个错误: ERROR 1130: Host '192.168.1.3' is not allowed to connect to this MySQL serve ...

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

    Host '***.***.***.***' is not allowed to connect to this MySQL server 其中***...是本机公网ip; 解决办法: 首先看报错窗口 ...

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

    /******************************************************************** * ERROR 1130: Host ’...′ is no ...

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

    解决远程连接mysql错误1130代码的方法 今天在用远程连接Mysql服务器的数据库,不管怎么弄都是连接不到,错误代码是1130,ERROR 1130: Host 192.168.2.159 is ...

  9. ‘Host’ is not allowed to connect to this mysql server

    ‘Host’ is not allowed to  connect to this mysql server mysql 数据库不允许远程连接 方法一:修改 host 表 进入mysql数据库,选择m ...

随机推荐

  1. css不受高度限制实现文本超出隐藏并以省略号结束

    文本超出省略号显示代码: overflow: hidden; text-overflow:ellipsis; white-space: nowrap;width: 100px; /*宽度做好限制*/ ...

  2. 闭包,jQuery插件的写法:图片预加载

    最近做的一些网页,单个网页图片量都比较大,网络不好的情况下,特别卡,这个图片预加载的方法可以牺牲一些时间换来网页的浏览顺畅,还是值得的. //闭包的写法,它内部的变量都是局部的,不会和外部巳有的变量进 ...

  3. php get接口,并在浏览器中以json格式返回查找到的数据

    php查询数据有6个步骤,分别为: 连接数据库服务器,使用的命令为:mysql_connect("服务器名称","用户名","密码") 选择 ...

  4. xtrabackup部署以及使用

    简介 备份mysql数据库一直是一个比较恶心的工作,主要就是备份的数据库比较大实在是慢.最近开始使用xtrabackup来备份数据库,速度上快了很多,尤其还原速度要快的多.下面我将从安装开始简要介绍一 ...

  5. 使用SQL Developer生成Oracle数据库的关系模型(ER图)

    客户要一张数据库的关系模型图,于是用SQL Developer来做. 一.SQL Developer版本 我在官网下载的最新版本(现在已经到了18.1,Oracle更新的太勤快): 2.如下图所示选择 ...

  6. 编译percona-server-locks-detail-5.7.22

    yum install -y binutils compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgc ...

  7. 数据挖掘---Matplotib的学习

    什么是matplotlib mat - matrix 矩阵                二维数据 - 二维图表            plot - 画图            lib - libra ...

  8. {windows故障}关于WIN7故障模块StackHash_0a9e解决方法

    问题背景:我给同事重装好系统后,想用驱动精灵(网卡版)给新系统安装驱动,但是在安装驱动精灵的过程中老是出现标题的问题,windows停止工作,导致无法安装,最后看到这两个方法后,把网络适配器禁用,然后 ...

  9. JavaScript -- 时光流逝(五):js中的 Date 对象的方法

    JavaScript -- 知识点回顾篇(五):js中的 Date 对象的方法 Date 对象: 用于处理日期和时间. 1. Date对象的方法 <script type="text/ ...

  10. Unity Shader 基础(3) 获取深度纹理

    Unity提供了很多Image Effect效果,包含Global Fog.DOF.Boom.Blur.Edge Detection等等,这些效果里面都会使用到摄像机深度或者根据深度还原世界坐标实现各 ...