Lost connection to MySQL server at reading....
phpMyAdmin - Error :
2013 - Lost connection to MySQL server at 'reading initial communication packet' I have an apache webserver running on a Fedora 10, with phpMyAdmin installed. I have a mysql server running on another Fedora 10 system. I have edited /etc/phpMyAdmin/config.inc.php with the IP-address of my mysql-server, my root-user and password. When I enter http://ip-address-of-webserver/phpMyAdmin and I log in with my root - credential, I get the above error. PhpMyAdmin.conf accepts connections from the clients connected to the LAN. But I don't think the issue is situated here. This is the configuration of my mysql-server : Code:
[root@database database]# hostname Code:
bind-address=127.0.0.1 Code:
tcp 0 0 localhost.localdomain:mysql *:* LISTEN |
Hi,
You state that you have changed your phpmyadmin config to contain the IP of your MySQL server. What IP have you put there? The localhost IP? Because your MySQL config (bind-address) makes it only listen on the localhost IP 127.0.0.1. If you want to access mysql with phpmyadmin from another pc using the webbrowser (instead of only on the linuxbox) then you'll have to change the bind-address on the my.cnf file and change your phpmyadmin config also. Also if you have a firewall enabled you should configure it to allow communication on port 3306 if you want to access your MySQL using another tool like MySQL Administrator. That should do the trick. |
Quote:
My webserver has IP-address 192.168.2.3 What IP-address should my MySQL-server listen to in stead of 127.0.0.1 ?? Should it listen to 192.168.2.4 ?? Quote:
|
The bind-address of your MySQL server should be 192.168.2.4 in the my.cnf file if you want to connect to that IP from the webserver. Restart the MySQL daemon in order to activate it. The netstat -al command should list that mysql is listening on the correct IP and not only on localhost. localhost setting only applies if you are running MySQL and your webserver on the same server.
In your phpadminconfig you also should put that IP for the MySQL. On the webserver, if you have a firewall configured, you normally don't have to change anything since the communication from webserver to mysql is outgoing and hence not blocked. If however you also have a firewall installed on the MySQL server, than there you should make sure that connection to it on port 3306 is possible for example with telnet 192.168.2.4 3306, which will show if connection is possible. It will not give you any reasonable data or options but only will show if the port is accessible. |
Quote:
2013 - Lost Connection to MySQL-server at 'reading initial communication packet', system error 113 Shutting down the firewall on my MySQL-server makes this error disappear. Then I get : Host '192.168.2.3' is not allowed to connect to this MySQL-server'. So I need to edit some accept/deny-rules somewhere, like I did with my apache. I'm a bit confused about port 3306 here... /usr/bin/mysql_config --port returns '0' |
Quote:
Probably you'll have to put the 'webserver' in the /etc/hosts.allow file in order to allow it to connect to the mysql server. Thing is that the webserver can connect to the mysql on the correct port but once connection is established the mysql server is going to check if the webserver is allowed access. If the webserver is not listed as allowed host then connection gets disconnected which is a normal security operation. Just changing the hosts.allow file (explanation inside the file) should do the trick if you don't have another firewall configured. If so then depending on that firewall you might also have to configure it that it should trust your webserver. Kind regards, Eric Van Steenbergen |
I've put the following in my /etc/hosts.allow
Code:
mysqld: 192.168.2.3 My iptables is turned off. When my iptables is turned on I still get the 'lost connection'-error. I have put the extra line in /etc/my.cnf : Code:
port=3306 Code:
Active Internet connections (servers and established) |
Succeeded in accessing my MySQL-server.
First off all I had opened port 3306/UDP which had to be 3306/TCP as I connect over a TCP-connection... Second I created a new user in the mysql.user DB with the permissions needed and with the 'Host'-value being the IP-address of my webserver. Thx for all the reply and feedback EricTRA ! |
Quote:
Can you telnet from the webserver to the mysql server? Code:
telnet mysqlserverip 3306 |
Quote:
Glad it works. And you're welcome. |
All times are GMT -5. The time now is 06:50 PM. |