[ERROR 2002 (HY000): Can’t connect to MySQL server on ‘**********.aivencloud.com’ (115)]

I got error # Error establishing a database connection;

[ERROR 2002 (HY000): Can’t connect to MySQL server on ‘**********.aivencloud.com’ (115)]

Hi there, @mis_S! I moved your comment to its own topic so we can answer this question independently of WordPress, since it could come up in other situations, too!

When you hit a Can’t connect to MySQL server error, it’s typically because of an incorrect IP address or port number when trying to connect to the server.

One thing you can try to troubleshoot this is, from your MySQL database in Aiven Console (Services > your-mysql-db), in the “Connection information” box, click “Quick Connect”:

This will give you some copy/paste commands you can use from the command line:

If these work, then you know it’s a problem with the connection from the application (WordPress, in this case). If not, then there’s a problem elsewhere; for example, maybe a local firewall blocking access to Aiven’s IPs or the port number on your end, or your own local IP not being in an allowed IP range under Service Settings > Cloud and network > Public IP filters (which defaults to “Open to all” but may have been switched).


For WordPress specifically, bear in mind that during the installer, as mentioned at Connect wordpress to aiven free mysql server - #2 by aiven_angie, the WordPress installer has a field for Database Host, but not Database Port. Since Aiven uses non-default MySQL ports you’ll need to “smoosh” the two together in the same field, like:

BLAHBLAH.aivencloud.com:24282

Let us know if that fixes it, or if not, what the result of running the “quick connect” command was, and we can go from there!

Where can I find Aiven’s IP and port?

Hey, there. You can find that info in your equivalent of that first screenshot (we use hostnames like ****.aivencloud.com, not IPs) by:

  1. Log into Aiven Console.
  2. From there, click Services
  3. Click the name of your Service from the table.

The “Connection Information” table should have everything you need. :sunglasses: