Website URL
https://kopikita-pekanbaru.42web.io
Error Message
SQLSTATE 2002
Other Information
tidak mucul menu nya
https://kopikita-pekanbaru.42web.io
SQLSTATE 2002
tidak mucul menu nya
Welcome to the InfinityFree community forum! Good to have you here.
This is an English-language forum, so here’s a translation of this post for everyone else. Please write in English if you can, or use a translation tool before posting (the forum has one built in).
SQLSTATE 2002 when the website connects to MySQL
Website URL:
https://kopikita-pekanbaru.42web.ioError Message:
SQLSTATE 2002Other Information:
the menu doesn’t appear
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 what comes after the number? It’s usually SQLSTATE[HY000] [2002] followed by something like “No such file or directory” or “Connection refused”. Also, what do you have as the database host in your site’s config?
The ending matters because 2002 is only the connection failing, and the words after it say why. For “No such file or directory”, the article below says the cause is localhost as the database hostname, which doesn’t work on InfinityFree. The host has to be the MySQL server for your account, and yours is sql212.infinityfree.com. If your config says localhost or 127.0.0.1, change it to that.
Here is the article on common MySQL connection errors, which covers hostname, database name and password:
he $dbHost in htdocs/db.php is sql212.infinityfree.com, matching the MySQL hostname shown in phpMyAdmin. The database has the expected tables, including 4 rows in menu_items. My temporary PHP test reports DB_ERROR; SQLSTATE=2002 and shows no further error text. Could a human check whether this hosting account can connect to its MySQL server? I have not shared any passwords.
The best way to verify whether the database connection works from the hosting account is by using a test script that tests the database connection. You’re already doing that, but your test script is only returning the error code, not the message. But SQLSTATE=2002 just means that there is a connection issue, it doesn’t say what the connection issue is. But that’s actually critical information to be able to troubleshoot this.