Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unable to connect to database


Guest

Recommended Posts

Hi,

 

When I try to view my site I get this error.

 

Warning: mysql_pconnect(): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /var/www/html/catalog/includes/functions/database.php on line 17

Unable to connect to database server!

 

My site was working a couple of days ago and I have not added or changed anything.

 

Line 17 on database.php is this:

 

      $$link = mysql_pconnect($server, $username, $password);

 

Anyone have any sugesstions of what I am doing wrong?

 

Cheers

 

Lee

Link to comment
Share on other sites

I think that's a mysql server problem. The fast way is restart mysql server. Or you can try restart the web server and reconnect the database. ;) good luck.

Fan of OSC system.................

Comming From China.............

Link to comment
Share on other sites

how would i do this?

Restart the Mysql server:

 

In unix os, you can kill the process of mysql and restart it.

In win os, you can stop the server and restart the mysql server from service manager.

 

Restart the web server:

 

If you are using apache, can run the apachectl command. type apachectl restart.That's it.

Fan of OSC system.................

Comming From China.............

Link to comment
Share on other sites

I doubt my hosting company will do that. It weird the site was working last time I checked and no one has viewed it or used it since I can't see where the proble has come from.

Link to comment
Share on other sites

Hi Lee,

 

You are running with pesrsistent connections set to true. (see mysql_pconnect rather than mysql_connect).

 

Normally this would not be a problem. You might want to try setting it to false by changing both

 

catalog/includes/configure.php and admin/includes/configure.php at or near the end of each file.

 

define('USE_PCONNECT', 'false'); // use persistent connections?

 

HTH

Tom

Link to comment
Share on other sites

The problem has seems to have sorted itself out without me doing anything. A server glitch maybe?

 

Thanks for all the help anyway,

 

Cheers

 

Lee

Link to comment
Share on other sites

  • 2 weeks later...

I am getting this problem again yet I have not done any work on the site in months? I have tried turning off non persistant connections but has no effect. Can anyone offer any advice on this as I cant see what the problem is.

 

Lee

Link to comment
Share on other sites

  • 4 weeks later...

if you have access to your server error and log files, you can see what may be going on there, then ask your host to 'reboot' the server, which kills all processes and reloads upon bootup. if on a 'virtual server' the reboot takes about 5 seconds, a 'restart' takes 1 second but does not kill all processes. if it continues, time to move servers.

Link to comment
Share on other sites

If the problem does resurface here are two things you can check - in your config files. If it says this

 

define('DB_SERVER', 'localhost')

 

change it to this

 

define('DB_SERVER', '127.0.0.1')

 

and if it says this

 

define('STORE_SESSIONS', ''); // leave empty '' for default handler or set to 'mysql'

 

change it to this

 

define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

 

Your hosting provider may have upgraded something without the 'support staff' knowing. Most support staff are working from a list of known problems on a computer screen and actually know no more than what they can read!

 

Hope this helps - Vger

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...