MySQL 如何在 Amazon RDS 数据库服务器实例上运行命令“mysqladmin flush-hosts”?

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

how to run command "mysqladmin flush-hosts" on Amazon RDS database Server instance?

mysqlamazon-rds

提问by user955461

I got a database server failure, says host is blocked because of many connection errors. It ask me to unblock with 'mysqladmin flush-hosts'

我的数据库服务器出现故障,说由于许多连接错误,主机被阻止。它要求我使用 'mysqladmin flush-hosts' 解除阻塞

how and where should I run this command to our amazon rds database server?

我应该如何以及在哪里运行此命令到我们的 amazon rds 数据库服务器?

thank you

谢谢你

回答by barryhunter

I dont use RDS, but with normal mysql, just connect with the 'root' user. Then issue

我不使用 RDS,但使用普通的 mysql,只需与“root”用户连接。然后发出

FLUSH HOSTS;

sql query.

sql查询。

Even in the case of too many connections, mysql should be keeping a connection in reserve so that a SUPER user can connect (usually root)

即使在连接太多的情况下,mysql 也应该保留一个连接,以便超级用户可以连接(通常是 root)

(mysqladmin on CLI usually just connects as root anyway, and issues the above sql :)

(CLI 上的 mysqladmin 通常只是以 root 身份连接,并发出上述 sql :)

回答by Chris

Login to any other EC2 instance you have that has access to the RDS instance in question and has mysqladmin installed and run

登录您拥有的任何其他 EC2 实例,该实例有权访问相关 RDS 实例并安装并运行 mysqladmin

mysqladmin -h <RDS ENDPOINT URL> -P 3306 -u <USER> -p flush-hosts

you will be prompted for your password

系统将提示您输入密码

回答by Garreth McDaid

When an Amazon RDS instance is blocked because the value of max_connect_errors has been exceeded, you cannotuse the host that generated the connection errors to issue the "flush hosts" command, as the MySQL Server running on the instance is at that point blocking connections from that host.

当 Amazon RDS 实例因超出 max_connect_errors 的值而被阻塞时,您不能使用产生连接错误的主机发出“flush hosts”命令,因为在该实例上运行的 MySQL 服务器此时正在阻塞来自那个主持人。

You therefore need to issue the "flush hosts" command from anotherEC2 instance or remote server that has access to that RDS instance.

因此,您需要从有权访问该 RDS 实例的另一个EC2 实例或远程服务器发出“刷新主机”命令。

mysqladmin -h [YOUR RDS END POINT URL] -P 3306 -u [DB USER] -p flush-hosts

If this involved launching a new instance, or creating/modifying security groups to permit external access, it may be quicker to simply login to the RDS user interface and reboot the RDS instance that is blocked.

如果这涉及启动新实例,或创建/修改安全组以允许外部访问,则只需登录 RDS 用户界面并重新启动被阻止的 RDS 实例可能会更快。

回答by Alex W

I fixed this error on my RDS instance by rebooting it from the AWS management console. HTH

我通过从 AWS 管理控制台重新启动它在我的 RDS 实例上修复了这个错误。HTH

[edit: lol downvotes]

[编辑:lol downvotes]

回答by Ryan

Since the hosts is blocked. try connect it from other host and execute the mysqladmin flush-hosts command.

由于主机被阻止。尝试从其他主机连接它并执行 mysqladmin flush-hosts 命令。

mysqladmin -h <RDS ENDPOINT URL> -P <PORT> -u <USER> -p flush-hosts

回答by Atis Lezdins

On Amazon RDS FLUSH HOSTS;can be executed from default user ("Master Username" in RDS info), and it helps.

在 Amazon RDS 上FLUSH HOSTS;可以从默认用户(RDS 信息中的“主用户名”)执行,它有帮助。

回答by Ram m.

You will have to connect your RDS through a computer which as mysql installed on it I used one of my hosting VPS using SSH

您必须通过一台安装了 mysql 的计算机连接您的 RDS 我使用我的一个托管 VPS 使用 SSH

After i was logged in my VPS ( i used putty ) It was simple, in the prompt i entered the following command:

在我登录到我的 VPS 之后(我使用了腻子)很简单,在提示中我输入了以下命令:

mysqladmin -h [YOUR RDS END POINT URL] -P 3306 -u [DB USER] -p flush-hosts

回答by Scudelletti

You can restart the database on RDS Admin.

您可以在 RDS Admin 上重新启动数据库。

回答by Syeful Islam

You can flush hosts local MySQL using following command:

您可以使用以下命令刷新主机本地 MySQL:

mysqladmin -u [username] -p flush-hosts
**** [MySQL password]

or

或者

mysqladmin flush-hosts -u [username] -p
**** [MySQL password]

Though Amazon RDS database server is on network then use the following command as like as flush network MySQL server:

虽然 Amazon RDS 数据库服务器在网络上,但使用以下命令就像刷新网络 MySQL 服务器一样:

mysqladmin -h <RDS ENDPOINT URL> -P <PORT> -u <USER> -p flush-hosts
mysqladmin -h [YOUR RDS END POINT URL] -P 3306 -u [DB USER] -p flush-hosts 

In additional suggestion you can permanently solve blocked of many connections error problem by editing my.ini file[Mysql configuration file]

另外建议你可以通过编辑my.ini文件[Mysql配置文件]永久解决blocked of many connections错误问题

change variables max_connections = 10000;

更改变量 max_connections = 10000;

or

或者

login into MySQL using command line -

使用命令行登录 MySQL -

mysql -u [username] -p
**** [MySQL password]

put the below command into MySQL window

将以下命令放入 MySQL 窗口

SET GLOBAL max_connect_errors=10000;
set global max_connections = 200;

check veritable using command-

使用命令检查名副其实

show variables like "max_connections";
show variables like "max_connect_errors";