Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

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.

SOLVED cPanel using wrong hostname to connect to MySQL server

Discussion in 'Database Discussions' started by Michael Legg, Oct 18, 2017.

  1. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    I've recently set up a fresh cPanel installation with MySQL running on a separate server.

    When I verify the MySQL database profile via WHM>>Manage MySQL Profiles>>Validate, it's all good.

    But when I create a database via cPanel, it doesn't appear in the user's cPanel>>phpMyAdmin and PHP connections fail with the message "Access denied for user 'user'@'hostname' (using password: YES)"

    I notice that the hostname appended after the username in the error message is incorrect. Which would explain why the user isn't recognised. How do I get cPanel to use the correct current hostname when connecting to the remote MySQL server?
     
  2. Michael Legg

    Michael Legg Member

    Joined:
    Mar 2, 2015
    Messages:
    15
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    New Farm, Queensland, Australi
    cPanel Access Level:
    Website Owner
    Server reboot fixed the hostname issue.

    Found the real problem was a '$' symbol in the password that was causing PHP to truncate the password at that character, therefore sending the wrong password to MySQL.
     
  3. cPWilliamL

    cPWilliamL cP Technical Analyst II
    Staff Member

    Joined:
    May 15, 2017
    Messages:
    257
    Likes Received:
    29
    Trophy Points:
    103
    Location:
    America
    cPanel Access Level:
    Root Administrator
    Perhaps MySQL needed restarting. I am glad to hear you were able to resolve the issue. Good catch on that password variable issue!
     
  4. ottdev

    ottdev Well-Known Member

    Joined:
    Oct 1, 2013
    Messages:
    104
    Likes Received:
    3
    Trophy Points:
    18
    cPanel Access Level:
    Root Administrator
    Ditto. Have had this happening for quite a while now. I never put time into checking if it's a known MySQL known issue or limitation (try setting a password that way by command line? maybe) vs. a problem with how cpanel treats the form input it sends to the server. With database authentication issues, we now immediately ask first if there's a $ in it!
     
Loading...

Share This Page