nakulgupta 0 Report post Posted March 25, 2005 My friends have a little forum running here. The problem is that quite often we get the following message when we try to open the page: 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 48Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331phpBB : Critical Error Could not connect to the database Why does this happen and what can we do to avoid it?? Share this post Link to post Share on other sites
kaputnik 0 Report post Posted March 25, 2005 Hey.. :)I've often had that problem.. most often than not .. its because of incomplete transfers of files due to lost packets while you FTP. As a solution to this, I do the following:1. re-upload the concerned file causing the problem as dictated by the error message (preferably re-upload the entire folder)2. Check all files for consistancy with the files on your local system. I do this using the Compare Directories function in LeechFTP although I do all my file transfers using WSFTP. 3. Check and recheck your config files to make sure you've got all the settings correct. Especially the settings that connect you to the DB.Usually, these steps should get you up and running. if it doesn't, then you may have a problem with your DB.. To cure any problems with that.. I'd suggest you Backup the tables with user data, as well as post data and dump your entire DB, drop all tables in your DB, run the SQL file that came with your installation of bb. .. and then re-populate the tables as required with all the user and post data... (DO all this only if you feel you've exhausted all other solutions, and feel compitent to do it)Hope this helped.. :(Rashid Share this post Link to post Share on other sites
Trekkie101 0 Report post Posted March 25, 2005 ^Never heard that one.As far as I was taught that means MySQL overloaded and is now broken, give it some time for the admin to reset it. Share this post Link to post Share on other sites
NilsC 0 Report post Posted March 25, 2005 when it has the error on a line like that it can be the script or permissions als. Did you get any other error messages?Nils Share this post Link to post Share on other sites
Muddyboy 0 Report post Posted March 29, 2005 Maybe this will helphttp://www.tech-recipes.com/rx/762/solve-cant-connect-to-local-mysql-server-through-socket-tmpmysqlsock/From the looks of it, you need the help of a website admin to fix it Share this post Link to post Share on other sites
vhortex 1 Report post Posted April 23, 2005 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 <{POST_SNAPBACK}> 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 Share this post Link to post Share on other sites
emersonbrum 0 Report post Posted April 25, 2005 It looks a problem in your code. You sould take a look there to fix it up.The fist line is telling you that there is problem in your code avoiding that it appers in another words could not connect to the server.2nd = second there is a wrong argument.3rd = A political security from your forum phpBB Share this post Link to post Share on other sites
vhortex 1 Report post Posted May 4, 2005 It looks a problem in your code. You sould take a look there to fix it up. The fist line is telling you that there is problem in your code avoiding that it appers in another words could not connect to the server. 2nd = second there is a wrong argument. 3rd = A political security from your forum phpBB <{POST_SNAPBACK}> 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 48Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 330Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/vhosts/rohit.bizhat.com/forums/db/mysql4.php on line 331phpBB : Critical ErrorCould not connect to the database* im sorry but I do believe that you have a misconception about the problem. The real error is the socket can no longer accept the connection. the next errors are the results of the 1st error. since the socket cannot process the request made and the webserver cannot create a connection, then mysql4.php also cannot finish its connection routine thus it output the errors that it have invalid arguments. in short, mysql4.php expects that it eithers get granted to access or be denied to the database.. since it cannot verify either of the two, it just output a generic error that there are some invalid arguments.. actually the one that output that are the webservers. Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 4, 2008 what is it? MySQL Database ProblemsWarning: mysql_connect() [function.Mysql-connect]: Access denied for user (using password: YES) in z:homelocalhostwwwforumdbmysql4.Php on line 48Access denied for user '' (using password: YES) Please help! -question by tohir Share this post Link to post Share on other sites
iGuest 3 Report post Posted December 21, 2009 Access denied for user MySQL Database ProblemsAccess denied for user 'Username'@'%' to database 'mydatabase'Hi,Am geting the message above once I try to connect to the database. This message stated to appear, although no changes where done to the database or the PHP code related to it.Can uou kindly advise why this has happened!!Thanks -question by Maden72 Share this post Link to post Share on other sites
iGuest 3 Report post Posted February 12, 2010 Look this problem generally occurs when the VAR and ETC directory of MySQL database gets corrupted which causes problems at the startup and also while transfering the files throufh FTP protocol. So, you need to repair it first. Use inbuilt utilities like‘Myisamchk’ and others to find and resolve the problem. But if it fails then you need to use any third party software like MySQL Repair software to resolve the issue. And to avoid the problem further you need to be little bit cautious while transfering the files through FTP like avoid huge file sizes etc. All the Best! -reply by Nancy Johnson Share this post Link to post Share on other sites
iGuest 3 Report post Posted May 6, 2010 Mysql Query Limit ExcedMySQL Database ProblemsHi, All, I am using joomla base website, I often see the above error, I don't know How I fix it. If anybody help, I will be thankful to you. I have any idea, on database error, If we switch the database login user to another user. Is it possible, If yes, then How? Thanks in advance-reply by Ahsan Share this post Link to post Share on other sites
iGuest 3 Report post Posted November 26, 2010 check this exampleMySQL Database Problemsuse this syntax to create the database mysql_query("CREATE DATABASE my_db",$con check this link related to this problem //https://www.mindstick.com/forum/61/there-are-some-problem-in-creation-of-database -reply by Raj dube Share this post Link to post Share on other sites