MySQL is not connecting!
There are many reasons why a database connection attempt to our servers may be failing. Listed below are a few of the most common error messages that you may come across.
There was an error connecting to the database / Unable to connect to the database
Unfortunately, it is very hard to determine what is actually wrong with a generic error message like this. You will need to determine the actual error message using the process below described for different types of applications:
WordPress: Enable the "display errors" mode following this guide from wordpress.com
Pre-Built Software: Enable display errors mode, or check for error logs. You may need to do an internet search to learn how to access them
Custom Built Software: Check for MySQL errors using mysqli_error or mysqli_connect_error in PHP (If using PDO, an exception will be thrown)
No matter how your application was created, turning on “Display PHP Errors” in the control panel (Located in the “Alter PHP Config” section) is a good way to show PHP errors on your website. Make sure to turn this option off after the problem has been solved.
No such file or directory / Directory could not be found
This error appears when you have incorrectly configured the connection details (Using localhost for the server is the most common reason). Make sure you are using the information that is provided in the database section of the control panel, and the MySQL section in the client area. Your MySQL password is different from the password that you use to login to TinkerHost.
Access denied for user (using password: YES)
This error is one of the most common for users, and appears when you have incorrectly configured the connection details (Using the wrong password for example). Make sure you are using the information that is provided in the database section of the control panel, and the MySQL section in the client area. Your MySQL password is different from the password that you use to login to TinkerHost.
Error connecting remotely
Free hosting does not support remote SQL connections. You can only connect to free hosting databases from your website. For example, the following are not supported here:
- Using databases for a mobile app
- A website not hosting on the same hosting account as the database
- A website hosted with a different hosting provider
- Connecting from a gaming service
If you need remote SQL connections for your site, you can upgrade to premium hosting, which does support this feature.
My error is not listed above
If your error is not listed above, make sure that you are doing everything listed below correctly:
- You are only connecting to your database from your website
- The hostname you are using is sqlxxx.thsite.top, with xxx being numbers
- The password you are using is the one displayed in the Client Panel under “MySQL”
- The username you are using is the one displayed in the Client Panel under “MySQL”
- The database name you are using is the one displayed in the “Databases” section of the control panel (You must define a database name to connect to your free hosting database)
If you are still having trouble, create a new topic on our community forum and ask our community for support.