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

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. arcpy实例教程-地图范围导出到要素类

    arcpy实例教程-地图范围导出到要素类 商务合作,科技咨询,版权转让:向日葵,135-4855_4328,xiexiaokui#qq.com 功能:将当前地图范围导出到内存要素类 描述:将当前地图的 ...

  2. PostgreSQL中的Object Identifier(oid)数据类型

    PostgreSQL在内部使用对象标识符(OID)作为各种系统表的主键.OID不会添加到用户创建的表中,除非在创建表时指定了WITH OIDS,或者启用了default_with_oids配置变量.类 ...

  3. 【视频开发】CximageMat 、CximagelplImage 以及 lplImageMat的转换、像素位深度

    1.传统的lplImage * -------> Mat格式 IplImage* img = cvLoadImage("greatwave.png", 1); Mat mtx ...

  4. Python 内置函数--super()

    描述 super() 函数是用于调用父类(超类)的一个方法. super 是用来解决多重继承问题的,直接用类名调用父类方法在使用单继承的时候没问题,但是如果使用多继承,会涉及到查找顺序(MRO).重复 ...

  5. abp_vue导入导出excel

    后端abp,前端vue导入excel,开始准备用直接用npoi,觉得要写太多的代码,就算从以前的复制粘贴也麻烦,所以偷懒直接用别人的轮子 Magicodes.IE.这样可以节省很多工作,根据实体生成e ...

  6. 小程序重置index,重置item

    重置index,重置item <block wx:for="{{index_data.banner_list}}" wx:for-index="idx" ...

  7. sql joins 7

    sql joins 7

  8. 【微信小程序学习笔记】入门与了解

    [微信小程序学习笔记(一)] IDE 下载安装 下载地址 官方工具:https://mp.weixin.qq.com/debug/w … tml?t=1476434678461 下载可执行文件后,可按 ...

  9. jenkins配合dockerfile部署项目

    前言 本节需要对jenkinsfile有点了解,对dockerfile有点了解,对shell有点了解,对docker有点了解 执行流程 jenkins拉取代码仓库中的代码 jenkins执行jenki ...

  10. python模块之openpyxl

    这是一个第三方库,可以处理xlsx格式的Excel文件.pip install openpyxl安装.如果使用Aanconda,应该自带了. 读取Excel文件 需要导入相关函数. from open ...