简体   繁体   English

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

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

I issued a command of:我发出了以下命令:

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

...in PhpMyAdmin. ...在 PHPMyAdmin 中。 Immediately after the execution, I was forced out PhpMyAdmin.执行后,我立即被强制退出 PhpMyAdmin。 I got:我有:

error错误

#1130 - Host 'localhost' is not allowed to connect to this MySQL server, #1130 - 不允许主机 'localhost' 连接到这个 MySQL 服务器,

how to resolve my problem?如何解决我的问题?

Use the IP instead:改用 IP:

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

For more possibilities, see this link .有关更多可能性,请参阅此链接

To create the root user, seeing as MySQL is local & all, execute the following from the command line (Start > Run > "cmd" without quotes):要创建 root 用户,看到 MySQL 是本地的,请从命令行执行以下命令(开始 > 运行 > "cmd" 不带引号):

mysqladmin -u root password 'mynewpassword'

Documentation , and Lost root access in MySQL .文档在 MySQL 中失去 root 访问权限

Find the file "config.inc.php" under your phpMyAdmin directory and edit the following lines:在 phpMyAdmin 目录下找到文件“config.inc.php”并编辑以下几行:

$cfg['Servers'][$i]['auth_type'] = 'config'; // config, http, cookie

$cfg['Servers'][$i]['user'] = 'root'; // MySQL user

$cfg['Servers'][$i]['password'] = 'TYPE_YOUR_PASSWORD_HERE'; // MySQL password

Note that the password used in the 'password' field must be the same for the MySQL root password.请注意,'password' 字段中使用的密码必须与 MySQL 根密码相同。 Also, you should check if root login is allowed in this line:此外,您应该检查此行中是否允许 root 登录:

$cfg['Servers'][$i]['AllowRoot']     = TRUE;        // true = allow root login

This way you have your root password set.这样你就设置了 root 密码。

Use this in your my.ini under在你的my.ini下使用这个

[mysqldump]
    user=root
    password=anything

暂无
暂无

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

相关问题 不允许主机 '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 #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 一些请求返回 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 #1130 - 主机 'localhost' 不允许连接到此 MySQL 服务器 - 运行 Acunetix 扫描后 - #1130 - Host 'localhost' is not allowed to connect to this MySQL server - After running an Acunetix scan phpMyAdmin不会停止抛出“#1130 - 主机'localhost'不允许连接到这个MySQL服务器” - phpMyAdmin won't stop throwing “#1130 - Host 'localhost' is not allowed to connect to this MySQL server ” 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