Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2008
    Location
    India
    Posts
    88
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Cannot connect Mysql through PHP

    Iam not able to connect to mysql server through php pages.I get error as
    Code:
    'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) in /usr/local/apache2/htdocs/openDB.php on line 4
    Error connecting to mysql'
    However,i can connect to mysql server through command prompt without any issue.
    In my.cnf,i have foll setting:
    Code:
    #socket		= /var/run/mysqld/mysqld.sock
    socket		= /tmp/mysql.sock
    I have commented original setting of 'var/run/mysqld/mysqld.sock' since the file is getting created at '/tmp/mysql.sock'
    bind-address is set to 127.0.0.1
    Desperately seeking solution...Any suggestions...
    In love with PHP,Mysql & Javascript

  • #2
    New Coder
    Join Date
    Aug 2008
    Location
    India
    Posts
    88
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I have not created a separate NT ID for mysql with name as 'mysql'.
    I am using my ID to access mysql
    does this create any problem in connection???
    In love with PHP,Mysql & Javascript

  • #3
    Super Moderator guelphdad's Avatar
    Join Date
    Mar 2006
    Location
    St. Catharines, Ontario Canada
    Posts
    2,634
    Thanks
    4
    Thanked 148 Times in 139 Posts
    the error message you have posted means the mysql server is not running.

  • #4
    New Coder
    Join Date
    Aug 2008
    Location
    India
    Posts
    88
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by guelphdad View Post
    the error message you have posted means the mysql server is not running.
    No,I checked mysql server running in background...and can telnet mysql port.
    BTW,problem is resolved..it was a case of missing php.ini in /usr/local/lib folder.
    I had compiled PHP manually from source.So,the php.ini file was missing from above path.
    Copied php-ini.redist to above path and renamed it to php.ini-->restarted apache and prob solved..
    Thanks for your reply though,as replies are very scarce in this forum
    In love with PHP,Mysql & Javascript

  • #5
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    as replies are very scarce in this forum
    You're kidding, right?


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •