If database is not showing in cpanel, make sure database exists in the server. If it exists, make sure permission/ownership of database is correct.
Then check whether database details are listed in /var/cpanel/databases/username.yaml
If it is not listed in it, run following command to fix it.
/usr/local/cpanel/bin/setupdbmap
Check cpanel and database should be listed in it.
If database size is zero while listing, run the following command to fix it.
/scripts/update_db_cache
If it’s not works
/scripts/upcp –force
/scripts/checkperlmodules –force
/usr/local/cpanel/bin/setupdbmap