[HCoop-Help] MySQL/PHP lost ability to connect in the last 24 hours

Davor Ocelic docelic at hcoop.net
Mon Sep 29 06:49:10 EDT 2008


On Sat, 27 Sep 2008 20:54:43 -0500
"C. Howell" <caden at hcoop.net> wrote:

> Hello,
> 
> I've made no changes to my portfolio in the last 24 hours, but PHP no
> longer connects to MySQL.
> 
> I can connect to MySQL from the command line:
> 
> caden at mire:~/caden_htdocs$ mysql -hmysql -p
> Enter password:
> Welcome to the MySQL monitor.  Commands end with ; or \g.
> Your MySQL connection id is 2956114
> 
> However, when I connect within a PHP page I get:
> 
> Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL
> server host 'mysql' (2) in
> /afs/hcoop.net/user/c/ca/caden/caden_htdocs/cadenhowell.com/samples/index.php
> on line 11

Okay, so looks the problem is not related to mysql per-se, but with 
inability to find or contact server 'mysql'.

> Warning: mysql_query() [function.mysql-query]: Can't connect to local
> MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in
> /afs/hcoop.net/user/c/ca/caden/caden_htdocs/cadenhowell.com/samples/index.php
> on line 37

Here we see that PHP is trying to connect through local unix socket,
which won't work because unix sockets only work locally and not accross
network.

In your case, you do need network connection to host 'mysql'.

> Does anyone have any suggestions?  Has anything related on the server
> changed?  Environment variables, network configuration related to
> mysql?  My whole portfolio site is database-driven so I'd be grateful
> for any tips.

Well first of all check if it's still giving the same message.

Then next thing is checking where you have defined your MySQL connection
settings, and see if you have host/port option explicitly set.

If it still tries to connect to local Unix socket on Mire, we'll 
see what to do next.

-doc



More information about the HCoop-Help mailing list