QUOTE (nakulgupta @ Mar 25 2005, 07:58 PM)
Warning: mysql_connect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 48
Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330
Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331
phpBB : Critical Error
Could not connect to the database
This is a server side error which only the webserver admin can correct.
mySQL servers have limited connections capability as of version 3.x, the max user can be atmost 100 connections.. at mySQL version 4.x, the connection goes up to 500 - 1000 connections as far as the last release I have on my pc.
Connection limit is base on the maximum current connections the server can handle.
Most of the time, mySQL server can process each query at a microsecond speed but there arise the question why some webservers encounter the error above.
1. First is that when mySQL server is accessed on the internet, there are countless of visitor that can access the website at any given time giving way to hammering and filling up all the connection slots to the servers.
2. Shared webserver hostings with shared connection poll will also trigger this event since assuming that there are 100 hosted sites sharing the same mySQL server with the same connection limit. If all 100 websites have 1 visitor at the exact time and 1 new visitor visits the same site at the same exact time, one of them will get that socket error if the max connection limit is 100.
3. There are times that we make scripts that connect to the database that are malformed. Malformed since they lack the full cycle of connection to the server. The full cycle is
a) locate server

connect and open connection
c) process query
d) disconnect and close connections
sometimes, we forget the closing part or we have a database connection command that are unreachable to the scripts.
Unclose connections stayed up in the server. For us the connection is finished but for the server, it will dutifully waits for the the client softwares or programs to send their disconnect commands.
For every unclose connection, a connection slot is taken and on default installation, the autotimeout of the database sometimes is set to 45mins.
--------------
Hope i solve the problem, the best solution is to contact the server admin for some assistance since mostly the settings are beyond your control.
geez, this seems so long, maybe I should put this one as a tutorial
Comment/Reply (w/o sign-up)