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

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. CORS-跨域问题:Access-Control-Allow-Origin Header and the ASP.NET Web API

    代码控制跨域: 如何使用:在 Global.asax 对应的控制类中: protected void Application_BeginRequest() { if (CorsFilter.IsOpt ...

  2. libusb: android上集成libusb库

    1. 下载libusb库. 可以到libusb库的官网(https://libusb.info/)或者是其官方的github仓库(https://github.com/libusb/libusb/re ...

  3. Android: VIVO手机setSpeakerphoneOn p无效,无法切换speaker的问题

    setSpeakerphoneOn 方法可以使语音和通话能够强制从手机的扬声器输出,不过在测试了众多手机在调用了这个API之后都可以,唯独有一款VIVO手机不可以: .小米6X(9.0) .Samsu ...

  4. [转]Vue-Devtools安装配置教程(献给伸手党)

    原文地址:https://blog.csdn.net/weixin_38654336/article/details/80790698 可以先看视频教程:链接 最简便的方法是用FQ来通过google应 ...

  5. React中跨域问题的完美解决方案

    针对react版本^16.6.0有多种解决方案 方案一:package.json中加上proxy代理配置 在packge.json加入 "proxy": "http:// ...

  6. Docker容器(六)——创建docker私有化仓库

    docker私有化仓库是为了节约带宽(外网速度慢或者干脆不能连外网),以及自己定制系统. (1).环境 youxi1 192.168.5.101 docker私有化仓库 youxi2 192.168. ...

  7. python 传入任意多个参数(方法调用可传参或不传参)

    1.可传参数与不传参数,在定义中给参数设置默认值 class HandleYmal: """ 获取测试环境的配置 """ def __ini ...

  8. 集群服务器+定时任务(Quartz) 重复执行的问题

    x StackExchange.Redis private readonly IDatabase _db; string key = string.Concat("{自己命名的Redis前缀 ...

  9. EasyDSS高性能RTMP、HLS(m3u8)、HTTP-FLV、RTSP流媒体服务器同步输出http-flv协议流是怎么实现的?

    http-flv是什么 http-flv是以http为传输协议,flv媒体格式为内容的方式实时下载flv音视频帧.为什么选择flv格式而非mp4?原因是mp4必须要有moov box或者moof bo ...

  10. net ads join 和net rpc join命令的区别

    要将主机加入Active Directory(AD),请输入: #net ads加入-U administrator 输入管理员密码:Passw0rd 使用短域名 - SAMDOM 加入'M1'到dn ...