#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    HK
    Posts
    1
    Rep Power
    0
    I have install the above on my pc
    mysql works fine on mysql>prompt and php runs fine with apahce as DSO module.
    However, when I have the following code in test.phtml :

    mysql_connect("localhost","webuser","");

    I have the following response:

    Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /home/httpd/html/test.phtml on line 5

    I cannot understand why. Since it is urgent to establish the combination, would any one pls give me a way to solve or a good way to install all above so that everything goes fine?

    Further, I have checked the mysql.sock belongs mysql user and group. When I change to root, there is no change .

    Thanks in advance

    ------------------
    ST WONG
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Englewood, CO
    Posts
    30
    Rep Power
    15
    My guess is that your default mysqld socket is either not 3306 or your connect needs to include the port number. Since you can connect via >mysql, your mysqld port is probably set to 3306, so it's probably your client port setting which isn't working. Maybe try this: "localhost:3306".

    You can find out mysqld's port by using: mysqladmin variables

    a guess...

    -TM
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2000
    Location
    Herndon, VA
    Posts
    1
    Rep Power
    0
    I have come across this as well. I'm not quite sure why but I fix it by using the actual hostname instead of localhost. Sounds odd but works. If anyone knows why I'd be interested in some insight as well.

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by stwong:
    I have install the above on my pc
    mysql works fine on mysql>prompt and php runs fine with apahce as DSO module.
    However, when I have the following code in test.phtml :

    mysql_connect("localhost","webuser","");

    I have the following response:

    Warning: MySQL Connection Failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111) in /home/httpd/html/test.phtml on line 5

    I cannot understand why. Since it is urgent to establish the combination, would any one pls give me a way to solve or a good way to install all above so that everything goes fine?

    Further, I have checked the mysql.sock belongs mysql user and group. When I change to root, there is no change .

    Thanks in advance

    [/quote]

Similar Threads

  1. Invalid characters with PHP and MySQL
    By gio50000 in forum MySQL Help
    Replies: 2
    Last Post: November 18th, 2004, 09:59 AM
  2. mysql, php, apache blogging reccomendations??
    By deiri87 in forum MySQL Help
    Replies: 6
    Last Post: September 25th, 2003, 10:25 PM
  3. Apache, PHP & MySQL not working
    By mikie7boy in forum PHP Development
    Replies: 3
    Last Post: July 6th, 2003, 01:18 PM
  4. How can a dummy get started with APACHE, PHP and MySQL?
    By TotalBeginner in forum Beginner Programming
    Replies: 4
    Last Post: October 20th, 2002, 04:03 PM
  5. Newbie Suse Php Apache MySQL Death
    By seanmayhew in forum Linux Help
    Replies: 2
    Last Post: August 28th, 2002, 11:51 AM

IMN logo majestic logo threadwatch logo seochat tools logo