Flush-Hosts in HTPC MIS

This article is for information purpose of Errors that are coming on Doordrishti Portal due to MySQL Errors.

Saurav Das

Last Update 7 months ago

Symptom

Error showing on Doordrishti similar to "Could not connect to HostAddress(hosts='172.16.114.xx'.port=3306, type='master')". Host is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

Possible Causes

  1. Incorrect Database Credentials:

    • Repeated failed login attempts due to an incorrect username or password.
  2. Misconfigured Application:

    • Your application may not be closing database connections properly, leading to too many open connections.
  3. Firewall or Network Issues:

    • Network instability or packet loss between the client and the MySQL server can result in connection failures.
  4. MySQL Configuration:

    • The MySQL variable max_connect_errors sets the threshold for connection errors before a host is blocked. If this value is too low, it could block hosts unnecessarily.
  5. Heavy Load:

    • If the application is trying to open too many simultaneous connections to the database, it might exceed MySQL's connection handling capabilities.

Resolution-1

Flush-hosts without help of Vantage Software

1. Search ‘MySQL Workbench’ in windows search area.

2. Open and navigate to ‘local host’ connection. And double click on it.

3. A prompt may appear for password. Enter ‘root’ as password.

4. A screen will appear where you can write down queries. Navigate to query page. It should be already open with some pre-ran queries.

5. Write there “flush hosts;” then select the query and then press execute button (Yellow Thunder like button just above the query) . After query run

Check now on Doordrishti portal.



This will reset the max_connection which is generally set at 151.

Resolution-2

Increase the 'max_connection' parameter in my.ini file of mySQL for permenent

1. Find the my.ini file of mySQL from the following directory


C:/ProgramData/MySQL/MySQL Server 8.0/my.ini


2. Copy this file to other folder.(As this is C Drive Computer will not allow user to edit, but we can replace this file as Administrator)

3. Open the my.ini file using notepad

4. Press (ctrl+F)   to find    max_connections   as shown in the image

5. change the value of max_connections= to desired value save.
6. Now replace this file in the same location where it originally copied from in the C:/Programe Data/MySQL/MySQL Server

7. Restart the MYSQL Service from the Service List of MIS PC as shown in the image below


How to check if connection size is increased?

 Run Query on MySQL Workbench as below and click on execute button

This step will increase the max_connection parameter permanently even after PC restarts. 

Reference: This  article is made with help of AI tool chatGPT.

Was this article helpful?

4 out of 4 liked this article

Still need help? Message Us