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 MySQL Authanticating with File User Owner

Discussion in 'General Discussion' started by kelepirci, Sep 23, 2011.

  1. kelepirci

    kelepirci Member

    Joined:
    Aug 27, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hello all,

    One of our VPS customer's cPanel installed VPS server is having very strange error. They complained about php database connection problem. When I invastigate the problem I have realised following error:

    Code:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/gunesank/public_html/test2.php on line 2
    Could not connect: Access denied for user 'nobody'@'localhost' (using password: NO)
    First, I tought this a simple MySql authantication error, but it was not. As you can see on abow, nobody user triying to authanticate @ localhost. nobody user is the file owner. If I change the file owner to simon the error message will change as follow:

    Code:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'siom'@'localhost' (using password: NO) in /home/gunesank/public_html/test2.php on line 2
    Could not connect: Access denied for user 'simon'@'localhost' (using password: NO)
    Is anyone has come across with such strange problem?:confused:
     
  2. milind

    milind Well-Known Member

    Joined:
    Jan 15, 2006
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Nasik (Maharashtra), India
    cPanel Access Level:
    Root Administrator
    Are you sure that you or your client have created the database and database user from Cpanel as when you create database user from cpanel username is like "domainusername_databaseusername".
     
  3. kelepirci

    kelepirci Member

    Joined:
    Aug 27, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    I am definitly sure. The DB user and password are correct and proper permissions for the user has been granted.
     
  4. milind

    milind Well-Known Member

    Joined:
    Jan 15, 2006
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Nasik (Maharashtra), India
    cPanel Access Level:
    Root Administrator
    but how they have been created? from cpanel? also can you please let us know the database and database username you see in Cpanel >> Mysql database
     
  5. kelepirci

    kelepirci Member

    Joined:
    Aug 27, 2006
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Yes, I am very sure and I have double checked. The user and dtabase has been created with cPanel and proper permissions are granted from cPanel.

    You can be sure that this is not a simple authantication issue. This is more than that :D
     
    #5 kelepirci, Sep 23, 2011
    Last edited: Sep 23, 2011
  6. milind

    milind Well-Known Member

    Joined:
    Jan 15, 2006
    Messages:
    113
    Likes Received:
    0
    Trophy Points:
    16
    Location:
    Nasik (Maharashtra), India
    cPanel Access Level:
    Root Administrator
    hmm.. i am not sure then.. coz without checking the cpanel I can't help... might be someone here have answers to your questions.
     
  7. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    676
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Please check if the following option is enabled in the /usr/local/lib/php.ini file:

    Code:
    sql.safe_mode
    If this option is enabled, please disable it and restart Apache. When this option is enabled, MySQL will try to use the cPanel username without a password for all database connections and not try to use the script's actual MySQL username and password for the connection.

    Thank you.
     
Loading...

Share This Page