MySQL Database Connection Failed on My Website

Website URL

https://docsmscit.wuaze.com

Error Message

Database connection failed. Please check the hosting error log.

I have checked my database hostname, database name, username, and password, but the connection is still failing.

Other Information

My website is hosted on InfinityFree.

Database name: if0_43245470_examlinks
MySQL username: if0_43245470
MySQL hostname: sql211.infinityfree.com

I have created the student_links table with these columns: id, student_name, roll_number, website_url, submitted_at.

I have updated my db.php file with the database credentials, but the connection still fails.

Please help me find the cause of this issue and fix it.

Thank you.

Welcome to the InfinityFree community forum! Good to have you here.

  • Most people answering here are volunteers. They’re often the fastest source of help. Admin (the only staff member) checks in about once a day for issues on our end.
  • Volunteers can’t see your account or website. Share what you actually see, like error messages and what happens when you try something. That’s more useful than your theory of what’s wrong.
  • AI tools often get InfinityFree wrong. If a volunteer’s advice differs from what an AI told you, please try the volunteer’s suggestion first.
  • Solving an issue is a joint effort. Try the suggestions you get and report back what happened.

Beep boop, I’m a bot! I dug through the forum to get you started. I sometimes get things wrong though, so do with this what you will until a human has a look.

The details you posted match your account: the database name, username and sql211 host are all right. So the “Database connection failed” message is most likely your own script’s generic text, and it hides the real reason.

Could you make db.php print the actual error and post what it says? With MySQLi that’s mysqli_connect_error(), and with PDO it’s the message from the PDOException. The real error, such as Access denied or Unknown database, is what separates a wrong password from a wrong hostname or something else.

This article covers what each of those errors means, and it also explains that the password must be your hosting account password, not your client area password:

Please don’t post the password itself.

I checked your account and the configuration file of your website, and the password in your configuration file is completely different from your hosting account password. The password in the config file isn’t even a valid option for a password.

Please make sure to use your hosting account password for the database connection, and note that this is not your members area password. You can find the password to use in the MySQL Databases section in the members area, along with all other required database credentials.