解决远程连接数据库: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 ...
随机推荐
- java excel给单元格增加批注(包含SXSSF)
package javatest; import java.io.FileOutputStream; import java.io.IOException; import org.apache.poi ...
- JMeter 使用 http长连接的方法
前言 如果需要在JMeter通过http长连接发送请求,首先需要选择了Use KeepAlive 长连接协议,虽然默认是勾选的,但也需要确认一下. 除了选择了Use KeepAlive 长连接协议,还 ...
- linux查找文件利器
查找文件 比如:找nginx.conf配置文件 locate nginx.conf /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/nginx ...
- LODOP一个任务多列,只打一列如何维护
打印维护是针对整个任务进行维护的,打印多少个打印项就要维护多少个打印项,维护了多少打印项,就要打印多少内容.但是打印的时候不需要打印其他列,可以把其他列的数值传入空置,add_print_text纯文 ...
- 使用Termux,在手机上做nodejs编程,运行nodejs程序。
如果你是一名nodejs开发者,是否想过以下问题:在手机上运行nodejs程序?用手机当nodejs服务器?在手机上做nodejs编程?YES!使用Termux,以上都可以做到! 下面展示如何实现这个 ...
- [LeetCode] 567. Permutation in String 字符串中的全排列
Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. I ...
- PCL读取PCD文件的数据
1.pcd文件——rabbit.pcd 链接:https://pan.baidu.com/s/1v6mjPjwd7fIqUSjlIGTIGQ提取码:zspx 新建项目pcl rabbit.pcd 和p ...
- Python-22-并发编程
一.进程 1. 什么是进程 狭义定义:进程是正在运行的程序的实例(an instance of a computer program that is being executed).广义定义:进程是一 ...
- 中国大学MOOC-翁恺-C语言程序设计习题集(一)
练习 02-0. 整数四则运算(10) 本题要求编写程序,计算2个正整数的和.差.积.商并输出.题目保证输入和输出全部在整型范围内. 输入格式: 输入在一行中给出2个正整数A和B. 输出格式: 在4行 ...
- 额。。。c++ sort()排序问题
首先呢 记得 这是个快排 不稳定 基本格式 头文件 #include<algorithm> #include<iostream> bool cmp(int x,int y) { ...