Mysql sporadic connection warning


#1

Hello all,

Yesterday I created my mysql sub-domain ‘mysql.auctionpilots.com’ and I was able to connect via ssh terminal and create tables. However, connecting via php, it sometimes comes back with the following warning:

Warning: mysql_connect(): Can’t connect to MySQL server on ‘mysql.auctionpilots.com’ (111) in /home/.odell/steveinsf/auctionpilots.com/test.php on line 3

The script I’m using is :

<?php $conn = mysql_connect("mysql.auctionpilots.com", "username", "password"); mysql_select_db("dbname" ,$conn); $string = "select * from testtable"; $result = mysql_query($string, $conn); echo "result is ".$result."--"; echo mysql_num_rows($result); ?>

The warning message occurs about once every 3 hits. Any ideas ??!?!?!


#2

Does switching to using persistent connections (mysql_pconnect()) help?


#3

I just tried using mysql_pconnect, but I’m still getting the same warning:

Warning: mysql_connect(): Can’t connect to MySQL server on ‘mysql.auctionpilots.com’ (111)
in /home/.odell/steveinsf/auctionpilots.com/test.php on line 3

Any other ideas ? Perhaps a network issue ?


#4

I think I see the problem. It looks like you setup a subdomain “mysql.auctionpilots.com”. You can’t create a MySQL hostname that’s the same as an existing subdomain (or vice-versa). Our system shouldn’t let you do this, but somehow it did (thought that bug had been corrected). Fixing this (either renaming the MySQL instance or removing the subdomain) and waiting a little should fix your problem.


#5

That did it !

I removed the sub-domain and a hour later the warnings went away. Thanks a lot for the help !