Subject: MySQL Error 1044 — Database Access Denied

Website URL

http://zsuites9999615230.free.nf/admin/create_admin.php

Error Message

Hello InfinityFree Support,

My website is hosted on InfinityFree, and I am getting this error when my PHP website tries to create an administrator account:

SQLSTATE[HY000] [1044] Access denied

I have checked that the database name, MySQL username, hostname, and password in my config.php match the details in the control panel.

I can open the database through phpMyAdmin, and the database tables are visible, but the PHP website cannot access the database.

Could you please check whether the database user has the correct permissions to access my existing database?

I do not want to delete or recreate the database because it already contains tables.

Thank you.

Other Information

http://zsuites9999615230.free.nf/admin/create_admin.php

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.

Could you post the full error text, including the part after “Access denied” that names the user and the database? Also tell me the exact database name and hostname that config.php uses. Leave the password out. That part of the message shows which database name PHP is actually trying to use.

I found an article on common MySQL connection errors. It says an “Access denied for user” error means PHP did reach the database server, but the user has no access to the database name it was given. It gives two likely causes: the database name is wrong, or the password is wrong.

The article also says to use the full database name, with the account prefix, exactly as the MySQL Databases section of your control panel shows it. The password to use is your hosting account password, not your members area password. The hostname should be the one in the control panel. For your account that looks like it should be sql301, not localhost.

Here is the article:

phpMyAdmin working doesn’t rule either cause out, because it logs in with its own stored details and not the ones in your config.php. So I can’t say yet which of the two it is. The full error text should show whether the database name PHP sent matches the one in the panel.

Other people have posted the same error code with a different cause, so I can’t say it’s the same thing here. If the name and password in the config do match the panel exactly, a person will need to look at the account.

Hello, thank you for your response.

Here are the details you requested:

Full error message:
SQLSTATE[HY000] [1044] Access denied for user 'if0_43051022'@'192.168.0.%' to database 'if0_43051022_suiteswebsitedatabase'

Database name in config.php:
if0_43051022_suiteswebsitedatabase

Database hostname in config.php:
sql301.infinityfree.com

I have checked that the database name, username, hostname, and password match the details shown in my hosting control panel. I can open the database in phpMyAdmin and see the existing tables (admins, enquiries, and rooms), but my website’s PHP code cannot access the database.

Could you please help me verify whether the database user has permission to access this database, or whether there is another account configuration issue?

I would prefer not to delete or recreate the database because it already contains my website tables.

Thank you.

I checked it too. And I can see that they clearly don’t match.

If you look at the list of databases for your account, you’ll see that it’s called if0_43051022_suitswebsitedatabase. That’s “suits”, not “suites”. Probably a typo, but one that does make the difference between a right and a wrong database name.

You can either update the database name in your website configuration, or export the existing database, create a new one with the right name, and import the data into it.