The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

problem with localhost

Discussion in 'General Discussion' started by dave9000, Nov 18, 2005.

  1. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    Looking into a issue for a fellow cpanel server admin. Every since the update 2 nights ago localhost can no longer connect to the mysql server using php, command line connects fine and so does phpmyadmin. However php will connect to the database using 127.0.0.1 instead of localhost.

    apache and php have been recompiled and made sure to be using system mysql which is 4.1.13, made no difference. Checked the host file and 127.0.0.1 localhost is in the /etc/host file.

    dig,nslookup and ping all return localhost as 127.0.0.1

    the error the php scripts are getting is can not connect to /var/lib/mysql/mysql.sock and yes it exists and yes it can be connected to via command line and yes /tmp/mysql.sock exists.

    there are some duplicate mysql.user entries, 1 has localhost for host and other has 127.0.0.1 for host

    We have removed each 1 at a time with no difference

    mysql has been updated /scripts/mysqlup --force

    I'm sure its something simple I am overlooking but damn if I know what it is at this time :D
     
  2. dave9000

    dave9000 Well-Known Member

    Joined:
    Apr 7, 2003
    Messages:
    891
    Likes Received:
    1
    Trophy Points:
    16
    Location:
    arkansas
    cPanel Access Level:
    Root Administrator
    I finally fixed it. If you are getting can not connect to /var/lib/mysql/mysql.sock using php scripts and localhost but php scripts will connect fine using 127.0.0.1 and phpmyadmin works in whm but does not work for cpanel clients and you can connect to the mysql.sock via command line in ssh. Check the /var/lib/mysql permissions.

    During a nightly server update the permissions on the /var/lib/mysql was changed to 0750, change the directory permissions to 0751 and localhost will start working again.

    Chirpy and DgBaker you may want to consider making this sticky as this problem will appear to defy fixing as everything appears to be correct.
     
Loading...

Share This Page