Latest News: (loading..)

Archived

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

lorr2000

Can't connect to local MySQL server through socket

14 posts in this topic

I am really at a dead end here. I can't figure out what is wrong. This the error i am getting

 

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/local/apache2/htdocs/includes/functions/database.php on line 19

Unable to connect to database server!

 

I don't know why this is. I have the setting in etc/my.conf to point to /var/lib/mysql/mysql.sock . I can create databases and all that no problem. I don't know why it is looking in /tmp/mysql.sock.

 

Is it in the code anywhere that it specifies to look there.

I need help please!!!

:(

Share this post


Link to post
Share on other sites

You need to post the catalog/includes/configure.php file.

 

Check this line first:

 

define('DIR_FS_CATALOG', '/the/server/path/to/my/catalog/');

 

Obvously it does not look exactly like that. :D

Share this post


Link to post
Share on other sites

I'm getting a similar error. and all I did was enable the PhPAdmin !!

 

This is my error:

 

Warning: mysql_connect(): Access denied for user: 'rolltexi_oscom@localhost' (Using password: YES) in /home/rolltexi/wwwroot/rolltexinc.com/osc/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

Share this post


Link to post
Share on other sites

I found this at the MYSQL web site. Maybe it will help.

 

[2.3] The error message "Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)..." is displayed. What can I do?

 

For RedHat users, Harald Legner suggests this on the mailing list:

 

On my RedHat-Box the socket of mysql is /var/lib/mysql/mysql.sock. In your php.ini you will find a line

mysql.default_socket = /tmp/mysql.sock

change it to

mysql.default_socket = /var/lib/mysql/mysql.sock

Then restart apache and it will work.

 

Here is a fix suggested by Brad Ummer in the phpwizard forum:

 

First, you need to determine what socket is being used by MySQL.

To do this, telnet to your server and go to the MySQL bin directory. In this directory there should be a file named mysqladmin. Type ./mysqladmin variables, and this should give you a bunch of info about your MySQL server, including the socket (/tmp/mysql.sock, for example).

Then, you need to tell PHP to use this socket.

Assuming you are using PHP 3.0.10 or better, you can specify the socket to use when you open the connection. To do this in phpMyAdmin, you need to complete the socket information in the config.inc.php3.

For example: $cfg['Servers'][$i]['socket'] = '/tmp/mysql.sock';

Have also a look at the corresponding section of the MySQL documentation.

Share this post


Link to post
Share on other sites
You need to post the catalog/includes/configure.php file.

 

Check this line first:

 

define('DIR_FS_CATALOG', '/the/server/path/to/my/catalog/');

 

Obvously it does not look exactly like that. :D

 

 

I'm having the same pb and I can't figure it out...

How can I find out what my path is for 'DIR_FS_CATALOG'??

 

My error is the following:

Warning: mysql_connect(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /data/11/0/133/7/948333/user/977971/htdocs/catalog/includes/functions/database.php on line 20

Unable to connect to database server!

 

is it "/data/11/0/133/7/948333/user/977971/htdocs/catalog/"??

 

Please let me know...

 

Mat

Share this post


Link to post
Share on other sites

Dont know if this has been solved elsewhere, but I've received this error several times during some of our installation. Every time the problem has been in the configure.php files with this line:

 

define('DB_SERVER', 'localhost');

 

Almost every host has a different setup, but this might solve the problem for you. You should be able to log into phpmyadmin or call tech support with your host, and they can provide you the server details.

 

Ex. Here are a few examples of what it could look like...

 

define('DB_SERVER', 'mysql123.myhost.com');

 

or GoDaddy, they use IP Address:

 

define('DB_SERVER', '10.1.10.1');

 

****

 

Also, to find the path to your catalog you can use the phpinfo(); command. Create a file in Notepad and add the following:

 

<?php
phpinfo();
?>

 

Then save to a file called phpinfo.php (make sure that you do save it as .php instead of .txt) upload it to your server via ftp or your servers file manager. Then in your browser navigate to the file. ex. mydomain.com/phpinfo.php

 

Scroll down and look for APACHE ENVIRONMENT, and the line DOCUMENT ROOT

 

Hope this helps!

 

Shean Hoxie

Webmaster- Kids Juke Box

Share this post


Link to post
Share on other sites

Im having the same problem. My admin is not working, i get the

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/x/y/z/xyzhostname/html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

The main site works fine. I triple checked the admin/includes/configure.php settings and everything is perfect. I'm at a loss as I know my settings are correct, I've set up at least 6 osCommerce/CreLoaded sites. When I get this error, I first check the configure.php settings, fix, then I'm done.

 

But this time, I'm stumped. The regular site works a charm, the admin is giving me a headache. Please help!

Share this post


Link to post
Share on other sites

I have the same issue only with admin, I migrated a client to another server and it started happening.

 

 

Im having the same problem. My admin is not working, i get the

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/x/y/z/xyzhostname/html/admin/includes/functions/database.php on line 19

Unable to connect to database server!

 

The main site works fine. I triple checked the admin/includes/configure.php settings and everything is perfect. I'm at a loss as I know my settings are correct, I've set up at least 6 osCommerce/CreLoaded sites. When I get this error, I first check the configure.php settings, fix, then I'm done.

 

But this time, I'm stumped. The regular site works a charm, the admin is giving me a headache. Please help!

Share this post


Link to post
Share on other sites

Help!!! total newbie to the site and to using these programs... this is the error code i'm getting:

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in /home/content/33/6718933/html/includes/functions/database.php on line 19

Unable to connect to database server!

 

I"m hoping to find out what i can do to fix it before i attempt to redo the whole thing! =(

Share this post


Link to post
Share on other sites

Hello everyone,

 

I am also getting same error,

It's my new store, i just upload my all data and database in to the server.

 

I check my all file in "/includes/configure.php" and "admin/includes/configure.php but still getting same error

 

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'xxx_osc'@'localhost' (using password: YES) in /home/xxx/public_html/includes/functions/database.php on line 20

Unable to connect to database server!

 

Please any one can help.

 

Thank you in advance.

Share this post


Link to post
Share on other sites

Please can someone help me fix the error I have like the above...

 

 

Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /www/sites/6b5/4c4/web/catalog/includes/functions/database.php on line 19

Unable to connect to database server!

 

Line 19 in database.php is below

 

if (USE_PCONNECT == 'true') {

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

} else {

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

}

 

I really don't know what is wrong and I have also reloaded configure.php with no joy. Please help.

Share this post


Link to post
Share on other sites

Dan,

 

 

Typically that error message has nothing to do with the database.php file. It is normally a user name / password mismatch for the database. Confirm the database name, User name and Database Password are correct.

 

 

 

 

 

Chris

Share this post


Link to post
Share on other sites

Dan,

 

 

Typically that error message has nothing to do with the database.php file. It is normally a user name / password mismatch for the database. Confirm the database name, User name and Database Password are correct.

 

 

 

 

 

Chris

 

 

Hi Chris, yes stupidly i change mysql database password, I have changed it back but i'm still getting the same message. what do you suggest?

 

Thanks

Dan

Share this post


Link to post
Share on other sites