远程连接数据时,报以下提示:

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

原因是数据库服务不允许远程登录,没有授权导致,解决方法如下:

登陆mysql数据库:

mysql –uroot –p123456

创建并授权一个专用的数据库wordpress用于存放blog数据:

create database wordpress;

show database like ‘wordpress’;

grant all on worpress.* to worpress@'localhost' identified by '123456';

注:当数据库和php服务不在同一台机器上,可执行如下命令授权

grant all on wordpress.* to wordpress@’192.168.0.%’ identified by ‘123456’;

刷新权限,使得创建的用户生效:

flush privileges;

查看用户对应的权限:

select user,host from mysql.user where user='wordpress';

[root@mysql ~]# mysql -uroot -p123456
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.5. MySQL Community Server (GPL) Copyright (c) , , Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database wordpress;
Query OK, row affected (0.00 sec)
mysql> grant all on wordpress.* to wordpress@'192.168.0.%' identified by '';
Query OK, rows affected (0.00 sec) mysql> flush privileges;
Query OK, rows affected (0.00 sec) mysql> select user,host from mysql.user where user='wordpress';
+-----------+-------------+
| user | host |
+-----------+-------------+
| wordpress | 192.168..% |
+-----------+-------------+
row in set (0.00 sec)

测试效果:

解决远程连接数据库: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远程连接 Host * is not allowed to connect to this MySQL server

    mysql -u root -p mysql>use mysql; mysql>update user set host =’%'where user =’root’; mysql> ...

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

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

  5. mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server

    mysql 远程访问不行解决方法 Host is not allowed to connect to this MySQL server 如果你想连接你的mysql的时候发生这个错误: ERROR 1 ...

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

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

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

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

  8. 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 ...

  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. LINUX企业应用案例精解 第2版 李晨光

    LINUX企业应用案例精解 第2版 李晨光 下载地址:https://pan.baidu.com/s/1AAKpc-l-qGTSX5h03M01XA 关注微信公众号获取提取码: 输入:lin7 获取提 ...

  2. Docker 搭建本地 cnpm 私有仓库

    1.首先启动本地的docker 2.下载 cnpm 仓库 git clone https://github.com/cnpm/cnpmjs.org.git 3.进入到 cnpmjs.org目录 cd ...

  3. 解决GitHub访问速度慢的问题

    https://github.com,但是页面很久才能打开 命令窗口,输入 ping github.com,超时 优化方法: 通过绕过DNS解析,直接在本地绑定host 1.查看ip DNS查看 地址 ...

  4. 第07组 Beta冲刺(3/4)

    队名:秃头小队 组长博客 作业博客 组长徐俊杰 过去两天完成的任务:学习了很多东西 Github签入记录 接下来的计划:继续学习 还剩下哪些任务:后端部分 燃尽图 遇到的困难:自己太菜了 收获和疑问: ...

  5. php HTTP协议

    HTTP协议 超文本传输协议(HTTP,HyperText Transfer Protocol) 最常见B/s架构中,使用,浏览器端与服务器端数据交互协议. 协议:约定好的一套语法规则. 规定:请求数 ...

  6. Zookeeper架构及FastLeaderElection机制

    原文链接:http://www.jasongj.com/zookeeper/fastleaderelection/ Zookeeper是什么 Zookeeper是一个分布式协调服务,可用于服务发现,分 ...

  7. Apache Kafka Producer For Beginners

    在我们上一篇Kafka教程中,我们讨论了Kafka Cluster.今天,我们将通过示例讨论Kafka Producer.此外,我们将看到KafkaProducer API和Producer API. ...

  8. 数列分段 II

    题目描述 思路 代码 #include <cstdio> int n, m, arr[100005], ans; int l, r, mid, inf = 0x7f3f3f3f; inli ...

  9. Numpy学习笔记(下篇)

    目录 Numpy学习笔记(下篇) 一.Numpy数组的合并与分割操作 1.合并操作 2.分割操作 二.Numpy中的矩阵运算 1.Universal Function 2.矩阵运算 3.向量和矩阵运算 ...

  10. "CreateProcess error=206, 文件名或扩展名太长。",用gradle构建项目创建mapper文件时提示这个错误,是Windows Gradle长类路径问题,官方已经修复

    用gradle构建项目mapper文件时,提示这个错误,这个是Windows Gradle长类路径问题, gradle官方已经解决了这个问题. 官网给出的解决方法地址:https://plugins. ...