解决远程连接数据库:Host is not allowed to connect to this MySQL server
远程连接数据时,报以下提示:
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的更多相关文章
- 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 ...
- 转:mysql远程连接 Host * is not allowed to connect to this MySQL server
在本机登入mysql后,更改"mysql"数据库里的"user"表里的"host"项,从"localhost"改为'%' ...
- 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> ...
- mysql不能链接远程,报(Host '***.***.***.***' is not allowed to connect to this MySQL server)
Host '***.***.***.***' is not allowed to connect to this MySQL server 其中***...是本机公网ip; 解决办法: 首先看报错窗口 ...
- 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 ...
- ERROR 1130: Host ’...′ is not allowed to connect to this MySQL server
/******************************************************************** * ERROR 1130: Host ’...′ is no ...
- ERROR 1130: Host is not allowed to connect to this MySQL server
解决远程连接mysql错误1130代码的方法 今天在用远程连接Mysql服务器的数据库,不管怎么弄都是连接不到,错误代码是1130,ERROR 1130: Host 192.168.2.159 is ...
- 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 ...
- ‘Host’ is not allowed to connect to this mysql server
‘Host’ is not allowed to connect to this mysql server mysql 数据库不允许远程连接 方法一:修改 host 表 进入mysql数据库,选择m ...
随机推荐
- SpringMVC 给请求路径加上统一前缀
最开始想到的是通过硬编码的方式手动在每个路径上加上前缀, 后面发现这种方式太不智能了,万一要修改那还不得改死, Spring既然支持EL表达式, 那能不能通过EL表达式的方式去读取配置文件里面的属性来 ...
- 缓存:修改Hosts不生效
修改Hosts为何不生效,是DNS缓存? - Barret李靖 - 博客园https://www.cnblogs.com/hustskyking/p/hosts-modify.html 换个未打开过的 ...
- matlab学习笔记8 基本绘图命令-初级二维绘图/交互式绘图
一起来学matlab-matlab学习笔记8 基本绘图命令_5 初级二维绘图/交互式绘图 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考书籍 <matlab 程序设计与综合应用&g ...
- 取消Windows server 2008关机提示备注的方法
打开“开始”-“运行”,在“打开”一栏中输入“gpedit.msc”命令打开组策略编辑器,依次展开“计算机配置”→“管理模板”→“系统”,双击右侧窗口出现的“显示‘关闭事件跟踪程序’”,将“未配置”改 ...
- [LeetCode] 273. Integer to English Words 整数转为英文单词
Convert a non-negative integer to its english words representation. Given input is guaranteed to be ...
- SpringBoot系列教程JPA之新增记录使用姿势
SpringBoot系列教程JPA之新增记录使用姿势 上一篇文章介绍了如何快速的搭建一个JPA的项目环境,并给出了一个简单的演示demo,接下来我们开始业务教程,也就是我们常说的CURD,接下来进入第 ...
- saltstack配置文件详解
软件依赖 Python版本大于2.6或版本小于3.0: 对Python版本要求 msgpack-python: SalStack消息交换库 YAML: SaltStack配置解析定义语法 Jinja2 ...
- Spring中的@ImportResource
简介 这个注解很简单,就是导入spring的xml配置文件 直接来看spring官方文档: In applications where @Configuration classes are the p ...
- [转帖]keepalived工作原理和配置、使用
keepalived工作原理和配置.使用 https://www.iteye.com/blog/aoyouzi-2288124 keepalived是什么 keepalived是集群管理中保证集群高可 ...
- Linux学习-防火墙-Selinux-配置本地YUM源
关闭防火墙并设置开机不启动 systemctl status firewalld.service #查看firewalld状态systemctl stop firewalld #关闭systemctl ...