Apparently, on windows, you have 5000 ports to work with and once they are opened, they remain so for 120 seconds before being released.
This causes problems with mysql/networking because a new port is requested for each connection.
# * If an setting is defined at both the global level and in a specific # stanza, the value in the specific stanza takes precedence.
Notes are meant not to be read by developers who already roughly know what they're searching about.
The file of your database should contain the following lines:default-character-set=utf8default-collation=utf8_general_ci It means that your database is created to use the utf8 characterset. I have frequent problems with PHP being unable to connect to My SQL after periods of extreme DB activity.
One way to accomplish this is: CREATE DATABASE my_database DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci; Then, after connecting to it from PHP you should use:mysql_set_charset("UTF8", $connection); If you don't do this, you will get ugly problems in case other software is reading and writing to the same database!!!!!! Long story short, it was because I was not running mysql via named-pipes and Windows was running out of available ports to serve PHP.
See also My SQL: choosing an API guide and related FAQ for more information. Note: Whenever you specify "localhost" or "localhost:port" as server, the My SQL client library will override this and try to connect to a local socket (named pipe on Windows).
Alternatives to this function include: The My SQL server. If you want to use TCP/IP, use "127.0.0.1" instead of "localhost".