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.

PHP Won't connect to mySQL

Discussion in 'General Discussion' started by deanstev, Feb 24, 2007.

  1. deanstev

    deanstev Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    0
    Hi Guys, for some reason, no PHP will connect to mySQL.

    The server will connect to the mySQL via command line, but when we try and access the databases via PHP, we are getting access denied.

    For some reason, the PHP just ignores the data we have sent for accessing the databases.. ie I will give the following example:

    cpanel username: axe
    db username: axe_uname
    db dbname: axe_database
    db password: anythinggoes

    Ok, when we try and connect, it ignores what we have set, and displays the following error:

    mysql://axe_database:mad:localhost/axe_uname failed to connectAccess denied for user 'axe'@'localhost' (using password: NO)

    Anyone got any ideas?

    I've recompiled apache with so many different combinations trying to get it working, and nothing budges!
     
  2. deanstev

    deanstev Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    0
    Oh and its PHP 4.4.2 with mySQL 4.1.21
     
  3. deanstev

    deanstev Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    0
    <ack, barfed forum times for some reason>
     
    #3 deanstev, Feb 25, 2007
    Last edited: Feb 25, 2007
  4. MMarko

    MMarko Well-Known Member

    Joined:
    Apr 18, 2005
    Messages:
    316
    Likes Received:
    0
    Trophy Points:
    16
    I think this is your problem "(using password: NO)".
     
  5. deanstev

    deanstev Well-Known Member

    Joined:
    Jun 10, 2004
    Messages:
    110
    Likes Received:
    0
    Trophy Points:
    0
    Thing is, we sent the password :(
    PHP is ignoring it.

    I don't get it.
     
  6. MMarko

    MMarko Well-Known Member

    Joined:
    Apr 18, 2005
    Messages:
    316
    Likes Received:
    0
    Trophy Points:
    16
    Have you checked mysql error logs?

    It is possible that mysql is not started with switch useoldpassword
     
  7. cPanelKenneth

    cPanelKenneth cPanel Development
    Staff Member

    Joined:
    Apr 7, 2006
    Messages:
    4,461
    Likes Received:
    22
    Trophy Points:
    38
    cPanel Access Level:
    Root Administrator
    Check your php.ini file and make certain sql.safe_mode = Off

    If it equals On, that is your problem.
     
  8. ac0x2102

    ac0x2102 Registered

    Joined:
    Jan 19, 2004
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Hello,

    Was this sorted out? I have the same issue. Mysql was set to use old passwords and safe_mode set to off. But the issue persists.
     
  9. JoehBloeh

    JoehBloeh Member

    Joined:
    Oct 22, 2003
    Messages:
    21
    Likes Received:
    0
    Trophy Points:
    1
    Hi,

    I'm having this problem also, and would like to see if anyone came across a solution!

    Please post if you know of anything that may resolve this!
     
Loading...

Share This Page