HTML Help
HTML Help Central . com

» Online Users: 49

1 members and 48 guests
Most users ever online was 695, 02-16-2011 at 07:01 AM.

» Site Navigation

 > FAQ

» Domains For Sale

Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2011
    Posts
    1

    Connection issues w/ mysql_connect() ???

    I've been looking for a solution on various forums for hours...

    I keep getting this error:
    Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

    the script that I'm using is

    PHP Code:
    $connection mysql_connect('localhost','username','password') or die ("<p class = 'error'>Sorry, we were unable to connect to the database server.</p>"); 
    The username and password are correct when I use them to log into phpMyAdmin. I've been looking at forums and people are saying to change the socket, but how do I go about doing that? I can see that PHP is attempting to connect via tmp/mysql.sock when I checked MySQL variables it says that the socket directory is /var/run/mysqld/mysqld.sock. How would I either change the socket directory in my script or change the directory in my mysql config file?

    The company I'm working for is using NetworkSolutions as their hosting server if that makes any difference.

    any help or advice would be great.

    -Brodie

  2. #2
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    1,766
    This post is just to remove this thread from the zero replies list. This post can be ignored.

Similar Threads

  1. Problem with Database connection!
    By utthara in forum PHP
    Replies: 1
    Last Post: 07-06-2011, 10:47 AM
  2. php problem with mysql_connect()
    By opticsnake in forum PHP
    Replies: 7
    Last Post: 09-27-2006, 04:01 AM
  3. More CSS issues...
    By aghast in forum HTML / XHTML / XML
    Replies: 4
    Last Post: 03-25-2004, 03:40 PM
  4. (ICQ) Can't establish connection
    By KC in forum Chat Central
    Replies: 6
    Last Post: 01-21-2002, 01:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBadvanced CMPS v4.1.1