Managing MySQL databases via browser make things easy. But, often it can show up MySQL query browser error 2003.
Am trying to access MySQL database through Microsoft SSIS application. But unfortunately, it’s getting failed. I think this is because of the permission issue. Could you please check on this?
That was a recent support request that came to our Server Administration Services Help-desk.
Today, we’ll see the typical reasons for MySQL query browser error 2003 and how our Support Engineers fixed it for our customer.
Accessing MySQL databases with a browser
In corporate world where employees work from different locations, managing databases via browser make things pretty easy. And, most database providers give access to databases from specific IP address.
Fortunately, there are many options like PHPMyAdmin, DbAdmin, HeidiMySQL, etc. that make databases accessible via browser. These interfaces help users to connect to the database servers using login details. But, for this to work, the MySQL server should accept connections from the user IP address.
However, when there are access restrictions, it can result in errors like “2003 – can’t connect to mysql server 10061“. For example, in this case, customer got the following error when trying to connect to the database via PHPMyAdmin.
What causes MySQL query browser error?
Now, its time to see the causes for MySQL query browser error 2003. From the vast experience in managing servers, our Dedicated Engineers typically see MySQL connectivity errors due to following 3 major reasons. They are:
1. MySQL server failure
One of the typical reason that results in error “2003 – can’t connect to mysql server 10061” is MySQL server failure. This happens when the MySQL server fails to start due to configuration errors. This typically occurs after a server reboot. And, when the user tries to connect to the DB server, it results in error.
2. Incorrect MySQL server settings
Again, incorrect MySQL server settings also can create trouble while connecting to the databases via browser. For example, the ‘skip-networking’ setting in the MySQL configuration file decides whether the server allows connections from outside network. This option resides in the MySQL configuration file, which is my.ini on Windows, my.cnf on Linux servers. If it is not commented out, server will not allow MySQL connections via browser.
MySQL server also maintains a list of hosts that can access the server. Therefore, for remote connections to work, user IP address should be listed in the Remote Database Access Hosts too.
3. Firewall restrictions
Similarly, another common reason for MySQL connection error is firewall restrictions. For connections to work, the server should allow TCP connections on MySQL port 3306. If proper firewall rules that white-list the user’s IP is not available on the MySQL servers, it can result in connection failure.
However, for security reasons, our Security Engineers always recommend providing MySQL server access only to specific IP addresses. This helps better tracking of connections.
How we fixed MySQL query browser error 2003
Now, its time to see how we solved the customer request to fix PHPMyAdmin error “2003 – can’t connect to mysql server 10061.”
Ensure MySQL server running
We began troubleshooting by checking the status of MySQL server. For connections to work, it should be running. In our case, MySQL server was already in started state. It was properly accepting connections too. And, if it is stopped, we start the service using the command:
service mysqld start
The customer’s IP address was already added in the Remote Database Access Hosts too. So, the reason for mysql query browser error 2003 was something else here.
Verifying MySQL server settings
Then, our Dedicated Engineers proceeded by checking the connection to the MySQL server. We tried to ping the server and it was working correctly.
The next step was to verify the MySQL server settings. It was properly configured to accept external connections. We checked and confirmed that MySQL server was properly accepting connections within the server. Therefore, the possible cause was firewall blocking the connection to MySQL server.
To correct the firewall problem, we had to modify the firewall rules on the server. The UFW firewall on the server was blocking access on port 3306. Therefore, to fix the problem, we added the following UFW rules to open port 3306.
ufw allow from 1xx.168.xx.0/24 to any port 3306
Here, we ensured that only customer’s specific IP address was given access on port 3306 of the server.
Or, if the server has iptables running, we open the port by adding the rule:
iptables -A INPUT -p tcp -s 1xx.168.xx.0/24 --dport 3306 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT
Similarly, when the MySQL server run on a Windows machine, we add the rules in Windows Firewall. For this, we go to the Control Panel and navigate to the Firewall Settings page. In Advanced Security, we add a new Inbound rule to allow connection on port 3306.
Again, in some scenarios, the network firewall will have port 3306 block. In such cases, our Support Engineers work with network providers to open the required MySQL port .
[Trouble connecting to MySQL server via browser? We can fix it right away.]
In short, Mysql query browser error 2003 happens mainly due to server connection problems. Today, we saw the top 3 reasons for the error and how our Support Engineers fixed it for our customer.