#1130 - 主机 'localhost' 不允许连接到此 MySQL 服务器 - 运行 Acunetix 扫描后

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/18449071/
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 18:40:23  来源:igfitidea点击:

#1130 - Host 'localhost' is not allowed to connect to this MySQL server - After running an Acunetix scan

mysqlphpmyadminwamp

提问by Lambasoft

I know this type of question has been asked lots of times, but none answer my problem. Please read carefully.

我知道此类问题已被问过很多次,但没有人回答我的问题。请仔细阅读。

I was running my website on localhost using Wamp server normally. When today i decided to run an Acunetix scan for vulnerabilities on my localhost server.

我通常使用 Wamp 服务器在本地主机上运行我的网站。今天我决定在我的本地主机服务器上运行 Acunetix 扫描漏洞。

Acunetix sent tons of commands to the mysql table in short period of time ( since it's localhost the commands went fast ) which cause my mysql server to crash with the error:

Acunetix 在短时间内向 mysql 表发送了大量命令(因为它是本地主机,命令运行速度很快)导致我的 mysql 服务器因错误而崩溃:

#1130 - Host 'localhost' is not allowed to connect to this MySQL server 

What I've already tried:

我已经尝试过的:

Running mysql through mysqld --skip-grant-tables I had access to mysql while on that, so I tried running

通过 mysqld --skip-grant-tables 运行 mysql 我当时可以访问 mysql,所以我尝试运行

DROP USER 'root'@'127.0.0.1'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';

But I got the error:

但我得到了错误:

mysql> DROP USER 'root'@'127.0.0.1'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables opt
ion so it cannot execute this statement
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'TO 'r
oot'@'%'' at line 1

I admit I do am a mysql noob but I did my homeworks and searched google, but was unable to find the solution.

我承认我确实是一个 mysql 菜鸟,但我做了功课并搜索了谷歌,但无法找到解决方案。

Any help ?

有什么帮助吗?

I managed ti fix the issue by reinstalling wamp server and fully uninstalling, even with the mysql.

我通过重新安装 wamp 服务器并完全卸载来解决这个问题,即使使用 mysql。

采纳答案by Marc Delisle

When your server is running with --skip-grant-tables, you disable all MySQL security so you're not allowed GRANT commands. What you can do, is access the "mysql" database and directly SELECT and UPDATE the rows you need to change. In your case it will be the user table.

当您的服务器使用 --skip-grant-tables 运行时,您将禁用所有 MySQL 安全性,因此不允许使用 GRANT 命令。您可以做的是访问“mysql”数据库并直接选择和更新您需要更改的行。在您的情况下,它将是用户表。

回答by Bhuvana Prakash

I had the same issue.

我遇到过同样的问题。

You can add skip-grant-tablesto the my.ini file for the [mysqld]tag, under # The MySQL server, and restart the mysql server.

您可以将标记添加skip-grant-tables到 my.ini 文件中[mysqld],在 下# The MySQL server,然后重新启动 mysql 服务器。

You can now open phpmyadmin and go to the user table in the mysql database. Make sure that the value of the password attribute is empty and that the value of host attribute is localhost. I was facing the second error. PHPMyAdmin was trying to connect with host value as 'localhost' and the table contained the value 127.0.0.1.

您现在可以打开 phpmyadmin 并转到 mysql 数据库中的用户表。确保密码属性值为空,主机属性值为localhost。我面临着第二个错误。PHPMyAdmin 试图将主机值连接为“localhost”,并且该表包含值 127.0.0.1。

Remove skip-grant-tables from my.ini and restart the mysql server. This should work.

从 my.ini 中删除 skip-grant-tables 并重新启动 mysql 服务器。这应该有效。

回答by Muhammad

A simple Illustrated solution!

一个简单的图解解决方案!

enter image description here

在此处输入图片说明

回答by echo_Me

     GRANT ALL PRIVILEGES ON *.* TO 'root'@'127.0.0.1';

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

http://dev.mysql.com/doc/refman/5.1/en/adding-users.html

EDIT.

编辑。

this because your mysql server is on read_only option. to turn it off

这是因为您的 mysql 服务器处于 read_only 选项。关闭它

connect to the server with root user:

使用 root 用户连接到服务器:

mysql-h localhost-u root-p

and run the command:

并运行命令:

mysql> set GLOBAL read_only = false;

mysql> FLUSH TABLES WITH READ LOCK;
mysql> UNLOCK TABLES;

EDIT2;

编辑2;

you must have stop the server and run this

你必须停止服务器并运行它

mysqld_safe --skip-grant-tablesdue to root pwd chg

mysqld_safe --skip-grant-tables由于 root pwd chg

so stop the server and start it normal with a start

所以停止服务器并启动它正常启动