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 MySQL server reported that no user with this name exists

Discussion in 'Database Discussions' started by Nahoo, Dec 21, 2016.

Tags:
  1. Nahoo

    Nahoo Member

    Joined:
    Oct 7, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    151
    I've just upgraded MySQL from version 5.5 to 5.6.34. And now all the MySQL users are no longer present!

    The cPanel equivalent is there, but this isn't much use without the actual corresponding MySQL user.

    On all websites with a database, there is the error:

    Warning: mysql_connect(): Access denied for user 'user_alias'@'localhost' (using password: YES) in /home/user/public_html/some_config.php on line 2

    and this is what happens when I try to reset the same user in cPanel | MySQL...

    (XID <randomcode>) Although the system’s database map includes a MySQL user named “user_alias”, the MySQL server reported that no user with this name exists. Contact your system administrator.

    I don't want to delete and readd hundreds of MySQL users and their permissions! There must be a better way to fix this!

    (I've changed some of the details here.)
     
  2. Nahoo

    Nahoo Member

    Joined:
    Oct 7, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    151
    I've checked the table: mysql.users and it is empty (besides the new users I've just added).
     
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,204
    Likes Received:
    1,297
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Did you make a backup of your databases before upgrading MySQL? If not, please open a support ticket using the link in my signature so we can take a closer look.

    Thank you.
     
  4. Nahoo

    Nahoo Member

    Joined:
    Oct 7, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    151
    Well, I have started on my own make-shift solution (starting with WordPress websites)...

    In Shell:


    grep -E "define\('DB_(USER|PASSWORD)'" /home/*/public_html/wp-config.php;

    Then copy and paste the results into your text editor (that supports Regex)...

    Find:

    [^:]+:define\('DB_USER', '(([^_']+_?)[^']*)'\);
    [^:]+:define\('DB_PASSWORD', '([^']+)'\);


    Replace with:

    CREATE USER '$1'@'localhost' IDENTIFIED BY '$3'; GRANT ALL PRIVILEGES ON `$2%`.* TO '$1'@'localhost';

    And back to Shell:

    mysql

    And then paste the resulting code back into there to create the MySQL users.
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    37,204
    Likes Received:
    1,297
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
  6. Nahoo

    Nahoo Member

    Joined:
    Oct 7, 2004
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    151
    I've gone through all the databases, checked their accounts and added the user listed in the config files with the relevant permissions. The WordPress config search really helped get the restoration underway, but the remaining accounts took some time.

    According to cPanel tech support, no one else seems to have experienced this problem...
     
Loading...

Share This Page