WordPress Error Establishing Database Connection – MySQL Database Missing

Website URL

https://leonardpetertech.infinityfreeapp.com

Error Message

Error establishing a database connection.

Other Information

My WordPress website was working after installation, but it now shows “Error establishing a database connection.”

My hosting account is active, and the WordPress files are still present in htdocs, including wp-config.php.

However, when I open MySQL Databases in the InfinityFree control panel, it says “No databases found on this account.”

Please check whether the original MySQL database created during the WordPress installation is missing, detached, or can be restored.

Hosting account: if0_43008524

Update: I followed the suggested database recovery step and created the database with the original name if0_43008524_wp378.

The database now appears in phpMyAdmin and contains my original WordPress tables, including wp1w_options, wp1w_posts, wp1w_users, wp1w_postmeta, and the Yoast tables.

However, my website still gives: “Cannot select database.”

WordPress can connect to the database server, but the database user 43008524_1 cannot select/use if0_43008524_wp378.

Could you please check/fix the permissions or association between this database and the MySQL user?

I have not deleted or reinstalled WordPress.

It would seem that something went wrong with the database user created by Softaculous. Fixing the database permissions for the current user is hard, but there is a very simple workaround: just use your account’s primary database user instead.

You can edit your website’s database credentials directly by editing the wp-config.php file of your website. In there, you’ll want to replace the existing database user 43008524_1 with the database user that’s listed in the MySQL Databases page in the members area (which is if0_43008524), and do the same with the password.

That will give working database credentials to WordPress and should restore your website without any data lost.