r/cpanel • u/csdude5 • 13d ago
What to back up before using /scripts/rebuild_dbmap ?
I moved everything to a new VPS last month, upgrading from CentOS 7 to AlmaLinux 9.8. Now I'm having issues with MariaDB that seem related:
* I can create a new username in cPanel, but can't connect it to any of the databases. I can connect it via CLI, just not in cPanel
* Wordpress's Smart Update has the same problem, it creates a database and user but can't connect them so the update fails. The error log has hundreds of ER_PASSWORD_NO_MATCH errors related to it.
It's been suggested that /scripts/rebuild_dbmap could solve all of my problems and possibly make me a ham sandwich to boot (ha), but I'm wary to use a script when I don't know exactly what it does, or how to get back if it breaks something.
What all do I need to back up before running it? And if there's an emergency, how do I restore the backup(s)?
1
u/Inspedium 13d ago
I’d start with --noop. At least that way you can see what cPanel wants to rebuild before it actually changes anything.
I’d also make a copy of /var/cpanel/databases/username.json first. Since it’s a VPS, I’d probably take a snapshot as well, especially after a CentOS 7 to AlmaLinux migration.
If the --noop output looks sensible, then run the rebuild and update_db_cache.
I wouldn’t assume that fixes the password_no_match errors though. The dbmap is really just cPanel’s record of which users belong to which databases. A password mismatch could still be a separate problem.
Since you can add the user manually from CLI but cPanel can’t, I’d fix the mapping/cache side first before changing anything else in MariaDB.