When connecting to a database, if there’s an issue with the connection details or the database itself, you may see one of these errors:
Unable to connect to server
Error 2013 (HY000): Lost connection to MySQL server
Error 2002 (HY000): Can’t connect to MySQL server
MySQL server has gone away
If you see one of these or a similar error, check the following, and if the issue persists, contact our Support team.
Check Connection Details
To check your database connection details, head over to the Info page.
If the connection is between an application and a database and both are hosted on Kinsta, make sure they use the same data center location and are connected through an internal connection. Additionally, we recommend selecting the Add environment variables to the application checkbox when adding the connection. This automatically populates the environment variables in the application from the database connection details.
If you are trying to connect your database to an external application or access your database with the command line or a database client/tool, double-check your database’s external connection details.
Suspend and Resume Database
If you’ve double-checked the connection details and an error persists, try suspending and resuming the database on the database Settings page.
Click Suspend database and confirm the suspension by clicking Suspend database again in the modal/pop-up.
To restart your database, click Resume database and confirm the restart by clicking Resume database again in the modal/pop-up.