0

I just moved my site to a new web host, and after changing the database-login file, it still can't connect. I get the following error:

Warning: mysql_query() [function.mysql-query]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /usr/www/users/simpleof/index.php on line 91

I changed the password and tried again, but it still doesn't work. All the information in the db-login is correct, so why can't I connect to the database?

0

4 Answers 4

2

Is the MySQL server on the same host as the web application? If not, you can't use a socket connection, and will need to connect via TCP.

If the MySQL server is on the same host, then maybe the socket is in a different location than '/tmp/mysql.sock'?

Without more information about what application/platform you're using, that's about all the help I can give.

2

Wow. I feel pretty dumb, but I put an extra space into the server name when I logged in.

So my advice to anyone else having this problem is REALLY check to make sure your log-in info is correct.

0

Check in mysql user privilages if your user's host is correct.

0

There was a recent update to Debian/Ubuntu which caused this error for me. I had to tweak some of the Ubuntu config to mysql work. You may want to check with your hosting company and see if this is the problem.

Not the answer you're looking for? Browse other questions tagged or ask your own question.