简体   繁体   English

#1130 - 不允许主机'localhost'连接到此MySQL服务器

[英]#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server

I accidentally changed the "host" value for the root user inside of the user table for mysql. 我不小心更改了mysql用户表中root用户的“host”值。

I need to change it back to localhost because I changed it to arancillary2125 (my other machines DNS name) but I cannot access mysql (from PHPMYADMIN or command prompt) due to "localhost" not having permissions any more. 我需要将其更改回localhost,因为我将其更改为arancillary2125(我的其他机器DNS名称),但由于“localhost”不再具有权限,我无法访问mysql(来自PHPMYADMIN或命令提示符)。

I am running windows XP // apache // 我正在运行Windows XP // apache //

I have tried the following solutions but they didn't work: 我尝试了以下解决方案,但它们不起作用:

https://serverfault.com/questions/92870/1130-host-localhost-is-not-allowed-to-connect-to-this-mysql-server https://serverfault.com/questions/92870/1130-host-localhost-is-not-allowed-to-connect-to-this-mysql-server

Whoops. 哎呦。

This is on your local machine, I assume? 我假设这是在你的本地机器上? At Start->Run, enter 'services.msc' and locate the MySQL service. 在Start-> Run,输入'services.msc'并找到MySQL服务。 Stop the service. 停止服务。

Edit: 编辑:

Find your my.ini file (usually in C:\\Windows or C:\\mysql, etc). 找到你的my.ini文件(通常在C:\\ Windows或C:\\ mysql等)。 If you don't have one, create one . 如果您没有,请创建一个 It's just a plain ASCII file. 它只是一个普通的ASCII文件。

Alter the file, add this in the [mysqld] section: skip-grant-tables . 更改文件,将其添加到[mysqld]部分: skip-grant-tables

On the command line, issue the command net start MySQL and wait a moment, the MySQL service should start. 在命令行上,发出命令net start MySQL并等一下,MySQL服务应该启动。

Still on the command line, issue the command mysql -u root and hit "ENTER". 仍然在命令行上,发出命令mysql -u root并点击“ENTER”。 You should be logged into MySQL as the 'root' user. 您应该以“root”用户身份登录MySQL。 Carefully change your grants and then logout. 小心地更改您的拨款,然后注销。 Stop the MySQL service / server. 停止MySQL服务/服务器。 Re-edit your my.ini file and remove / comment out the skip-grant-tables line, and again start the server. 重新编辑my.ini文件并删除/注释掉skip-grant-tables行,然后再次启动服务器。 Try to login as root again. 尝试再次以root用户身份登录。

Just tested this on my Win XP Pro box. 刚刚在我的Win XP Pro盒子上测试了这个。

This essentially has the effect of bypassing all the grant tables and thus doesn't bother to lookup whether you're supposed to access it from that machine or not. 这基本上具有绕过所有授权表的效果,因此无需查询是否应该从该机器访问它。

MySQL reference manual : --skip-grant-tables option MySQL参考手册:-- skip-grant-tables选项

So I had this problem aswell, happened all of a sudden with #1130 - Host 'localhost' is not allowed to connect to this MySQL server. 所以我也遇到了这个问题,突然发生#1130 - 主机'localhost'不允许连接到这个MySQL服务器。

After searching and searching I can tell you that bdl solution is the way forward, once you can log back into the server you can change the permissions about and remove the line skip-grant-tables under your my.ini mysql config file. 搜索和搜索后,我可以告诉你bdl解决方案是前进的方法,一旦你可以重新登录到服务器,你可以更改权限,并删除my.ini mysql配置文件下的skip-grant-tables行。

I would have just upvoted bdl's post but im too new on the website to do that yet. 我本来只是赞成了bdl的帖子,但我在网站上的新功能还没有。

重新创建arancillary2125(即使在旧的桌面上),然后以这种方式访问​​您的数据库。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 #1130-不允许主机“ localhost”连接到该MySQL服务器 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server #1130-不允许主机“ localhost”连接到该MySQL服务器 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server 不允许主机 'localhost' 连接到此 MySQL 服务器 (#1130) - host 'localhost' is not allowed to connect to this MySQL server (#1130) #1130 - 不允许主机 'localhost' 连接到这个 MySQL 服务器 - #1130 - Host ‘localhost’ is not allowed to connect to this MySQL server 一些请求返回 SQLSTATE[HY000] [1130] 不允许主机 'localhost' 连接到生产服务器上的此 MySQL 服务器 - some requests return SQLSTATE[HY000] [1130] Host 'localhost' is not allowed to connect to this MySQL server on production server phpMyAdmin不会停止抛出“#1130 - 主机'localhost'不允许连接到这个MySQL服务器” - phpMyAdmin won't stop throwing “#1130 - Host 'localhost' is not allowed to connect to this MySQL server ” #1130 - 主机 'localhost' 不允许连接到此 MySQL 服务器 - 运行 Acunetix 扫描后 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server - After running an Acunetix scan mysql 连接器错误 1130:主机不允许连接到此 MySQL 服务器 - mysql connector error 1130: host not allowed to connect to this MySQL server 1130主机'amazon-ec2-ip'不允许连接到此MySQL服务器 - 1130 Host 'amazon-ec2-ip' is not allowed to connect to this MySQL server mysqli_real_connect()(HY000/1130)Host 'localhost' is not allowed to connect to this MariaDB server - mysqli_real_connect()(HY000/1130)Host 'localhost'is not allowed to connect to this MariaDB server
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM