---
title: "如何解决Host 'HostName' is not allowed to connect to this MySQL server"
author: "yang8820"
date: "2013-02-28T12:50:29Z"
tags: []
categories: ["数据库"]
slug: "host-hostname-is-not-allowed-to-connect-to-this-mysql-server"
draft: false
lastmod: "2013-03-05T09:26:50Z"
id: 1817706
url: "https://yang8820.iteye.com/blog/1817706"
---

**如何解决Host 'HostName' is not allowed to connect to this MySQL server**

注：hostName为你连接电脑的名称。

今天在移MySQL数据库时，远程连接出现 Host 'HostName' is not allowed to connect to this MySQL server。在这里记录下来。

出现这个提示的原因是：登录MySQL数据库的用户有访问主机限制。将该用户的Host更改为需要访问数据库的主机IP或“%”（%表示所有主机可访问），重启MySQL服务即可。