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. python 标准类库-并行执行之subprocess-子进程管理

    标准类库-并行执行之subprocess-子进程管理 by:授客QQ:1033553122 1.使用subprocess模块 以下函数是调用子进程的推荐方法,所有使用场景它们都能处理.也可用Popen ...

  2. zsh快捷键

    bash和zsh两种shell功能非常相似,只不过zsh的功能比bash更强大一些.这两种shell的快捷键命令也非常相似,对于常用shell的人来说,了解一些快捷键操作将会十分有益,因为使用快捷键将 ...

  3. [20180808]exists and not exists.txt

    [20180808]exists and not exists.txt --//生产系统遇到的一个性能问题,通过例子来说明: 1.环境:SCOTT@test01p> @ ver1 PORT_ST ...

  4. Oracle根据已有表的数据建立新表

    需要保证create的表内的字段与select的表一致. create table 表名(字段名,字段名,字段名,字段名,字段名,字段名) as select * from 表名

  5. 语句调优基础知识-set statistics profile on

    set statistics profile on 获取语句真实的执行计划信息 set statistics profile on go select distinct Productid,unitp ...

  6. linux shell 指令 诸如-d, -f, -e之类的判断表达式简介

    一.文件比较运算符 1. e filename 如果 filename存在,则为真 如: [ -e /var/log/syslog ] 2. -d filename 如果 filename为目录,则为 ...

  7. NumPy 中的集合运算

    怎样快速找出两个数组中相同的元素? numpy.isin(element,test_elements,assume_unique = False,invert = False ) 计算test_ele ...

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

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

  9. DVWA v1.9 新手指南

    DVWA简介 DVWA(Damn Vulnerable Web Application)是一个用来进行安全脆弱性鉴定的PHP/MySQL Web应用,旨在为安全专业人员测试自己的专业技能和工具提供合法 ...

  10. GitHub-创建仓库与本地同步

    1. 在Linux上安装Git [root@mini05 ~]# yum install -y git ……………… 2. 本地创建ssh-key信息 [root@mini05 ~]# ssh-key ...