Welcome Guest ( Log In | Register )




                Web Hosting Guide

2 Pages V   1 2 >  
Reply to this topicNew Topic
MySQL Database Problems
nakulgupta
post Mar 25 2005, 11:58 AM
Post #1


Advanced Member
Group Icon

Group: Members
Posts: 173
Joined: 22-March 05
From: Hyderabad,India
Member No.: 3,155


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:

QUOTE
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


Why does this happen and what can we do to avoid it??
Go to the top of the page
 
+Quote Post
kaputnik
post Mar 25 2005, 05:10 PM
Post #2


Premium Member
Group Icon

Group: Members
Posts: 233
Joined: 11-February 05
From: Bangalore
Member No.: 2,607


Hey.. smile.gif

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.. smile.gif

Rashid
Go to the top of the page
 
+Quote Post
Trekkie101
post Mar 25 2005, 07:35 PM
Post #3


Teh Teckeh Trekkeh
Group Icon

Group: Members
Posts: 682
Joined: 8-September 04
From: Scotland, UK
Member No.: 389


^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.
Go to the top of the page
 
+Quote Post
NilsC
post Mar 25 2005, 08:16 PM
Post #4


To Err Is Human, To Forgive Divine
Group Icon

Group: Members
Posts: 558
Joined: 24-December 04
From: http://www.ultimatekayakfishing.
com/
Member No.: 1,871


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
Go to the top of the page
 
+Quote Post
Muddyboy
post Mar 29 2005, 04:26 AM
Post #5


Member [ Level 1 ]
Group Icon

Group: Members
Posts: 33
Joined: 29-March 05
Member No.: 3,343


Maybe this will help
http://www.tech-recipes.com/mysql_tips762.html

From the looks of it, you need the help of a website admin to fix it smile.gif
Go to the top of the page
 
+Quote Post
vhortex
post Apr 23 2005, 06:55 AM
Post #6


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937


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
cool.gif 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 laugh.gif
Go to the top of the page
 
+Quote Post
emersonbrum
post Apr 25 2005, 08:24 AM
Post #7


Newbie [ Level 2 ]
Group Icon

Group: Members
Posts: 10
Joined: 25-April 05
Member No.: 4,355


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
Go to the top of the page
 
+Quote Post
vhortex
post May 4 2005, 02:25 AM
Post #8


Guilty Until Proven Innocent
Group Icon

Group: Members
Posts: 372
Joined: 13-April 05
Member No.: 3,937


QUOTE (emersonbrum @ Apr 25 2005, 04:24 PM)
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
*


CODE
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
*


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.
Go to the top of the page
 
+Quote Post
iGuest
post Dec 4 2008, 05:26 AM
Post #9


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


what is it?
MySQL Database Problems

Warning: mysql_connect() [function.Mysql-connect]: Access denied for user (using password: YES) in z:\home\localhost\www\forum\db\mysql4.Php on line 48 Access denied for user '' (using password: YES) 
Please help!
 
-question by tohir
Go to the top of the page
 
+Quote Post
iGuest
post Dec 21 2009, 10:31 AM
Post #10


Newbie [ Level 1 ]
Group Icon

Group: Members
Posts: 0
Joined: 1-November 07
Member No.: 25,869


Access denied for user
MySQL Database Problems

Access 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

Go to the top of the page
 
+Quote Post

2 Pages V   1 2 >
Reply to this topicNew Topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Collapse

> Similar Topics

    Topic Title Replies Topic Starter Views Last Action
No New Posts 5 ssp2010 34 Yesterday, 08:00 PM
Last post by: 8ennett
No New Posts 2 cybernaut 988 18th March 2010 - 08:33 AM
Last post by: iG-W4L4CH1
No new   32 Mitch666Holland 7,108 18th March 2010 - 01:26 AM
Last post by: iG-yonek
No New Posts   3 Kian Mike 1,106 17th March 2010 - 07:41 PM
Last post by: iG-K. Adjei
No new   20 WeaponX 6,221 16th March 2010 - 03:35 PM
Last post by: iG-Rizwan
No New Posts   13 rmdort 6,415 2nd March 2010 - 08:20 PM
Last post by: John Heinl
No New Posts   4 HannahI 180 1st March 2010 - 12:34 AM
Last post by: magiccode9
No New Posts   5 Eggie 201 27th February 2010 - 01:51 PM
Last post by: 8ennett
No New Posts   2 8ennett 158 25th February 2010 - 11:42 AM
Last post by: 8ennett
No new   26 ejfetters 8,090 24th February 2010 - 06:49 AM
Last post by: iG-redshaft
No New Posts   9 wutske 1,183 23rd February 2010 - 09:10 AM
Last post by: iG-manleh
No new   50 Poison_the_well 11,874 22nd February 2010 - 06:21 PM
Last post by: iG-mike
No New Posts   10 glodrop 3,767 19th February 2010 - 06:29 AM
Last post by: iG-upeka
No New Posts 7 Jonnyabc 186 17th February 2010 - 08:31 AM
Last post by: mastercomputers
No New Posts   13 Jimmy89 3,131 16th February 2010 - 05:52 PM
Last post by: iG-John


Web Hosting Powered by ComputingHost.com.
HONESTY ROCKS! truth rules.
Creative Commons License