Inexisting databases and users showing on cpanel

Operating System & Version
CENTOS 7.9 kvm
cPanel & WHM Version
v92.0.9

UnknownFan

Registered
Jan 19, 2021
3
0
1
Brazil
cPanel Access Level
Root Administrator
Inexisting databases and users showing on cpanel

Few months ago I upgraded my Server from a shared host to a VPS
Some databases were migrated and I removed them on mysql workbench. Problem is, the users and list of databases names still show on
"REDACTED/cpsess1700227365/scripts5/manage_database_users" and "REDACTED/cpsess1700227365/scripts5/manage_databases"

At this moment, nothing is supposed to be on the database. And looking with php admin, I can see there are no other schemas than the default ones from mysql itself.

How Do I Synchronize this? I tried reinstalling mysql and upgrading but It didnt help.
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
Hey there! cPanel doesn't have any integration with the MySQL workbench tool, so it's always a good idea to remove users and databases directly from the cPanel interface whenever possible.

If there is cruft left of the users you may need to check a few different areas to ensure they are removed. One would be the /var/cpanel/databases area of the system, as the username.json file in that directory stores the user access for each database and account.

You may also need to check the MySQL user table itself to see if there are still entries there, which can be done with this command from the terminal:

Code:
mysql -e "select * from mysql.user" | grep USERNAME
Just replace the "USERNAME" portion with what user you want to search for.

That's where I would start my hunt for this, but let me know if that doesn't get things resolved!
 

UnknownFan

Registered
Jan 19, 2021
3
0
1
Brazil
cPanel Access Level
Root Administrator
Hi, thanks for the reply.

/var/cpanel/databases files have the old data that I need to remove. Can I just delete all the json's and .caches ? Do I need to rebuild them later?
There are no databases or users being used. So Deleting should be ok. right?
 

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
7,496
1,009
313
cPanel Access Level
Root Administrator
Sorry, I should have been more clear on that. You wouldn't want to remove those files completely, but just edit them to remove the affected database user. Even if there should be no users, you'll still want that file to exist. I'd recommend backing up the file first before making any edits.

Here's an example of the content of the file for a user that has no databases, and only includes the default user connection string:

Code:
{"PGSQL":{},"MYSQL":{"owner":"username","dbs":{},"dbusers":{},"noprefix":{},"server":"1.2.3.4"},"version":1}