Wordpress and website can't connect to SQL Database

This concerns abel-formation.com
The error message on the website is “error connecting to the database” and in Wordpress I get “The MySQL Database could not be selected”.

This is a Wordpress site being transferred from OVH using a backup and FileZilla. The site has been uploaded into the htdocs file. The database was created and uploaded using cpanel in Infinity. The wp-config.php has been updated with the relevant information for the Infinity database and has been double checked by two people. It points to the correct database, with the correct username and password. Do I have to modify anything else? Thanks for your feedback.

Are you sure this is correct?

DNS does not seem correct as well

3 Likes

Hello KangJL, thanks for your reply. When I modify the nameserver with OVH, I no longer receive my e-mails. I have an OVH E-mail Pro account linked to my domain name managed by OVH. I can send email, but I no longer receive them when I enter the Infinity nameservers. Any solutions? Thanks.

Did you add a MX record?

4 Likes

Hello KangJL, no I didn’t. Do I use the MX record found on OVH and add it to Infinity?

Yes, only if you are using Infinity nameservers…

4 Likes

Just added 4 MX records from OVH to Custom MX records on Infinity.

My hosting with OVH ends 1st July. If I change the nameservers to Infinty nameservers on OVH before that date, will that create some sort of conflict? If not, I’ll change the nameservers now.

You can proceed with the migration perhaps around 5 days before expiry.
Expect some downtime though.
Remember to put up some maintenance/migration notice on the old host while migrating.

4 Likes

Thanks KangJL for your great advice. Much appreciated :smile:

Hello, sorry to come back to this. I have to set up the site now. I have a custom domain abel-formation.com. Each time I install Wordpress, I get the same error: can’t connect to the database.

Wordpress creates a database and names it. It creates it’s own DB user, DB password and DB host in wp_config. After, it can’t connect to the MySQL database. So, I change the DB user, DB password and DB host to that provided in my Infinity account in the wp_config.php. Doing so has given me access once to Wordpress editor and the site online. Once. I thought I’d solved the problem. No. Signed out and signed back in and same problem. Unable to connect to the database. I’ve deleted the site and database several times and reinstalled to no avail. In Wordpress management, the database details do not change even when I’ve modified the wp_config file in php. Any solutions out there?

No issue when see from the front


If you can’t connect to the db,try go to Softaculous > Installations and click on the orange pencil icon at the right of Wordpress to modify the installation.At there you can change the db credentials.
You can also try to seek for whether there’re options in the wp-admin that says anything about the dbs.It might altered your wp-config.php after logging in.(By manually editing the config file first,of course.)

2 Likes

Hello Frank419, Thanks for your suggestions. I still have the same problem. Here is what I did and did not do:
Installations : I’ve changed the db credentials: db user, password & host.
Still the same problem after.
wp-admin : I opened the file in File Manager. I couldn’t see a php file listed as database or db. Should I be looking in a specifically named file?
wp-config : that is still good according to File Manager and hasn’t been modified. It still has the credentials provided by Infinity Free and not those created by Wordpress.
Any ideas? :slight_smile:

This is what I’m getting when I try to access the site:

And when I try to Log into the Wordpress editor:

Sorry it’s in French. Just says “Error trying to connect to the database”…

Hello Frank419, I’ve just been let in after creating a second administrator. I’m not using his access. I’m using my first administrator. Just a coincidence? Or maybe the server needed time to accept the modified DB credentials in insatllation? I’ve been here before though, so my access may not be permanent. Will see.
Thanks Franck419

When I try to visit the site using Wordpress I get this:

So the same problem. Is it just Infinity Free having problems?

I believe that it is possible that infinityfree’s sql servers are encountering with problems.
I saw no posts on your site(no important data),maybe you can try reinstalling or fixing installation?A corrupted installation might cause db issues.See also


Screenshot attached

1 Like

Hi, can you try enabling display errors?

4 Likes

Hello Ziverre, yes done it and the log is telling me that [22-Jun-2023 13:40:03 UTC] PHP Warning: mysqli_real_connect(): (HY000/1203): User if0_34431850 already has more than ‘max_user_connections’ active connections in /home/vol1_1/infinityfree.com/if0_34431850/htdocs/wp-includes/class-wpdb.php on line 2019
[22-Jun-2023 13:40:03 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/vol1_1/infinityfree.com/if0_34431850/htdocs/wp-includes/class-wpdb.php on line 2051
[22-Jun-2023 13:40:03 UTC] PHP Warning: mysql_connect(): User if0_34431850 already has more than ‘max_user_connections’ active connections in /home/vol1_1/infinityfree.com/if0_34431850/htdocs/wp-includes/class-wpdb.php on line 2051
etc, etc,
Sonce I’ve been able to edit the site in Wordpress, with enormous difficulty as Wordpress constantly tells me it can’t save the modifications. Now I have no access to the site or Wordpress. Same error "can’t connect to the database. Are the limits?

Yeah it seems to be caused by your website opening unusual amount of database connections, which can be caused by either so many traffics (though it should not trigger it unless in rare circumcations) or you have installed plugins which open many database connections in background.

5 Likes