不允许主机 localhost 连接到此 MySQL 服务器

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25003590/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:56:04  来源:igfitidea点击:

host localhost is not allowed to connect to this MySQL server

mysqlapachexampp

提问by saasaa

I've accidentally deleted my users table (removed all users) now whenever I try to access my database it says: "host localhost is not allowed to connect to this MYSQL Server". I've tried connecting directly, same error. I'm using apache xampp for this.

我现在不小心删除了我的用户表(删除了所有用户),每当我尝试访问我的数据库时,它都会说:“不允许主机本地主机连接到这个 MYSQL 服务器”。我试过直接连接,同样的错误。我为此使用了 apache xampp。

回答by Talha Tanveer

A very commonly asked question, try doing this (and it worked for me), goto your mysqlfolder and there will be a file called my.ini. Simply add skip-grant-tables(without an argument) in the [mysqld]section as below:

一个非常常见的问题,尝试这样做(它对我有用),转到您的mysql文件夹,将有一个名为my.ini. 只需skip-grant-tables在以下[mysqld]部分添加(不带参数):

[mysqld]
port=3306
skip-grant-tables

Save the file, restart your server. If the problem still exists, refer to this link.

保存文件,重启服务器。如果问题仍然存在,请参阅此链接