Change max_connect_errors in MySQL - mysql

I need to change max_connect_errors on MySQL but I have no SSH control into the server, can you change it just using a mysql query?
If not can anyone advise how I would change this on amazon's RDS service? It doesn't seem to be in their parameter options.
Thank you!

Here's how I fixed it:
Create a new db parameter group (using command line tools, or console)
Change max_connect_errors in the new parameter group. My command looked like this
rds-modify-db-parameter-group -C cert-xxxxxx.pem -K pk-xxxxx.pem --db-parameter-group-name=customdb --parameters "name=max_connect_errors,value=10000,method=immediate"
or it can be done in the console.
Modify your database in console to use new parameter group
Restart rds instance. When it comes back it will use the new parameter group with the higher max_connect_errors

It seems Amazon now allows changing this parameter.
You might also want to set skip_name_resolve to 1, unless you need it.

First you need to create an RDS parameter group. This is a "profile" of settings that you can apply to your RDS instance.
Next, you need to use the RDS command line client, or API tools to make the settings modifications to your RDS parameter group.
You also need to make sure the RDS parameter group is applied to your RDS instances
Dave

The parameter groups can now be modified fully within the console with a handy search for value fields. Some of the AWS documentation and many answers out there to this kind of question point to setting up the CLI which is no longer necessary.
As mentioned earlier; you can set skip_name_resolve to 1. This will bypass the logic as it will stop performing reverse DNS lookups to resolve host names from the connected client.
In AWS you can use security groups to block systems that should not have access to the MySQL server.

For RDS, you will have to adjust the values of the parameter by editing the parameter group attached to your RDS instance.

show variables like 'max_connect_errors';
/* to show current setting */
set global max_connect_errors=100000000;
/* or any number you want */
make sure you login as an user have privileges to execute set global
This is no good for amazon-rds

Related

How to use init_connect in azure database server for mysql

Have created a mysql server which has somehow log_bin set to ON and enforce_gtid_consistency is also set to ON. Now this is causing few issues in my case and i want to turn OFF those variables.
Process i have tried
1. Create a .my.cnf file in user root (~/.my.cnf) and added
[mysqld]
enforce_gtid_consistency=OFF
Result: No changes. It doesnt take effect.
2. In azure portal in init_connect variable i have set "SET enforce_gtid_consistency=OFF;" (because there is no mention of this variable in server parameters).
Result: Cant connect to mysql after setting up value in this parameter.
Is there any way we can fix this?
May be the following doc is helpful:
https://learn.microsoft.com/en-us/azure/mysql/concepts-read-replicas#global-transaction-identifier-gtid
Once GTID is enabled, you cannot turn it back off. If you need to turn GTID OFF, please contact support.

Can't connect to MySQL on AWS from Workbench or CLI Error 10060

Over the last 24 hours I have created and re-created an AWS MySql instance and tried to connect from both MySQL Workbench and CLI from my Windows 10 laptop. I have not been successful. I have set up the database using the "Standard Create" and "Free Tier" templates ensuring that I am connected to the default VPC, the database is "publicly accessible", and using only "password authentication".
After the database has been created, I select the default security group associated with the DB instance, and change the "inbound" rules to accept "All" traffic from "All" protocols in "All" port ranges, from "All" sources (0.0.0.0/0 and ::/0) as well as specific "MySQL/Aurora)" TCP on Port 3306 from "All" sources (0.0.0.0/0 and ::/0).
The "outbound" rules also allows "All" traffic from "All" protocols in "All" port ranges, from "All" sources (0.0.0.0/0 and ::/0) in case the problem is the response getting back to my laptop.
This seems to cover the widely-accepted solutions for making this connection...but even still, I checked my Windows firewall and router to be confirm that port 3306 was not blocked.
Can anyone think of another possible cause for this connection issue? At this point, I must be missing something really simple-stupid, so any help would be greatly appreciated.
EDIT 1
I have reviewed the similar issue here: https://serverfault.com/questions/706819/unable-to-connect-to-rds-instance-from-outside-vpc-error-2003-hy000-cant-con?newreg=5b9e8fe57f7644119d6c7e7ba91f2fb2
The route table associated with the 3 subnets for the VPC look like this (with an "igw"):
EDIT 2
My RDS MySQL DB is standalone. I do not have an EC2 instance running. The only EC2 Resources I use are the Security Groups that are associated with my default VPC.
EDIT 3
I finally created a new account on AWS and a brand new mySql DB. I also uninstalled all of my MySql products (Workbench, Server, Installer, etc) and reinstalled workbench. I added one new inbound rule to enable all traffic/ports/sources. With all of these changes, I was able to connect the very first time. The only thing I noticed this time in setting up my database was that the default inbound rule included All Traffic/Ports/Protocols but with the source set to the default security group instead of an IP range.
I am leaving the question unanswered because I don't still know what caused this to work.
Under Connectivity, while you are creating a DB try to create a new VPC and DB Subnet group
new VPC security group makes sure you add inbound rule [all traffic] any pv4
Virtual private cloud (VPC) Settings
Hope it helps I had a hard time with this one

AWSCLI: Can't specify db parameter group when creating mysql read replica

Using awscli, I'm trying to create a cross-region read replica, in us-west-1, of a mysql RDS in us-east-1. The db must have the lower_case_table_names parameter set to 1(default is 0). I have created a custom db parameter group with this setting. When I call "aws rds create-db-instance-read-replica" and specify my custom parameter group with "--db-parameter-group-name", the command fails with the following error:
An error occurred (InvalidParameterCombination) when calling the CreateDBInstanceReadReplica operation: A parameter group can't be specified during Read Replica creation for the following DB engine: mysql
AWS documentation makes no mention of this limitation(that I can find). Obviously, in this case, changing the parameter group after the replicant is created is not an option. Has anyone else encountered this, and is there a work-around?
Edit: Wound up just letting the replica come up with default parameters. Even though that caused the replication to fail and left status at "error", once the replica was available I switched it to my custom parameter group. Then I rebooted it, and it came right up and replicated without issue. May not work in every case, but seems to have worked in mine.

How do I configure IntelliJ IDEA to use clear-text password authentication for a MySQL data source?

I've tried a few different ways of defining my MySQL database connection in IntelliJ, but can't seem to connect.
Requirements:
Uses an SSH proxy server
Needs the password sent in clear text.
My understanding is that the MySQL driver should have a built in plugin for this, called mysql_clear_password, and that I should be able to enable it on the Advanced tab of the database configuration by declaring its classname (com.mysql.jdbc.authentication.MysqlClearPasswordPlugin) and/or setting the LIBMYSQL_ENABLE_CLEARTEXT_PLUGIN variable to 1, Y or y.
I can't seem to get it to work. Can someone provide guidance on the correct way to do this in the IDE?
One needs to specify additional JDBC parameter authenticationPlugins with value mysql_clear_password.
Also, see https://dev.mysql.com/doc/connector-j/5.1/en/connector-j-reference-configuration-properties.html

How do I initialize character set settings for a new RDS MySQL instance

I would like to set the following variable for my Amazon RDS server, where do I provide this setting when I create a new RDS instance?
character_set_server=utf8mb4
Note: I want these settings to be permanent and I don't want to modify them every time I re-start the server.
You need to use an RDS DB Parameter Group to do that.
You can create new parameter groups through the aws dashboard but you won't be able to actually change any of the parameters. You'll need to use an API client for that.
As a warning, I don't think RDS yet supports using utf8mb4 in a parameter group. I get an error from the API when I attempt to set character_set_server to that value.