Q:

MySQL connection taking time to open

I am using MySQL on wamp server. It takes 0.6 secs to establish a connection with mysql database, however when I use persistence connection it takes 0.035 secs. I read people comments on php manual and found that mysql_pconnect runs out of connections soon. Any suggestion how to improve connectivity time?

A:

There's no way it should take 0.6 seconds.  Slow connection time is almost always related to DNS lookups.  
Try starting your MySQL Server with skip_name_resolve option enabled in your my.ini file.

Re your comments that you cannot connect:  It's hard to guess the reason for this because there are so many reasons for a connection failure.  

Error 1045 Access denied:  See Causes of Access-Denied Errors.  You may have GRANTed privilegs to a mysql user in such a way that doesn't enable that user when connecting via localhost/127.0.0.1.
Error 2003 Can't connect to MySQL server:  See Can't connect to [local] MySQL server or the article on the MySQL Forge: Error2003-CantConnectToMySQLServer

There are other connection troubleshooting steps, but they depend on the nature of the failure.  Can you be more specific about what error message you're getting?

