Cannot connect local deployment to MySQL

Hello. I installed and deployed a local version of retool as described here: Trialing Retool locally

And I'm running a MySQL server on my Ubuntu machine. When I try to connect retool to my database in the "Configure MySQL" page, I enter:

host: localhost
port: 3306 (this is the correct port)
database username: root
database password: [correct password for root]

And I get the error: Unable to connect. Error: connect ECONNREFUSED 127.0.0.1:3306

This is true whether I use SSL connection or not. I also get the same error if I change the port to something wrong like 3308. I've checked the mysql error logs and don't see anything about a failed login attempt, which I DO see if I simply try to start the mysql client with an incorrect password (so I know some logging is happening).

Oh, last detail - if I use the host "host.docker.internal" as suggested in the UI, I get the error "Unable to connect. Error: getaddrinfo ENOTFOUND host.docker.internal"

I'm a beginner with both MySQL and retool, so I'm at a loss as to what to do. Any help would be massively appreciated!

Hello Bryce!

Hope to get this solved for you! So, depending on your OS and version of Docker you may need to use the address 172.17.0.1 instead of host.docker.internal (which we require you to use when hosting your db locally). Here is an example of how I managed to connect to a web server running locally:

Are you seeing any authentication attempts within your database server logs?

Also, we had users in the past need to configure MySQL to allow connections from hosts other than localhost, and I needed to configure Docker to connect to an external network.

Let's start with this and then take it from there! Happy to help along the way. :smile:

Hi! Thanks for the feedback. I'm closer to getting it to work.

Using 172.17.0.1 instead of host.docker.internal helped. To configure MySQL to allow connections from hosts other than localhost, I did the following:

Added to /etc/mysql/my.cnf:
[mysqld]
bind-address = 0.0.0.0

Starting mysql from the root user, I ran:

create user 'retool'@'%' identified by '[I created a password]';
grant all privileges on . to 'retool'@'%';
exit;

Then I restarted the server.

Now, when I try to connect without SSL, I get this error: "Unable to connect. Error: ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol requested by server; consider upgrading MySQL client". I don't see anything more specific in the error logs. This seems weird though, because I just installed mysql, presumably using the latest release.

When I try to connect with SSL, I get this error: "Unable to connect. Error: self signed certificate in certificate chain".

I haven't had time to dig into either of these errors yet. Have you seen them before?

Thanks again,
Bryce

The answers here fixed it!

Ah! Thanks for the info, Bryce.

Woah! Apparently, this is frequently asked! :sweat_smile:

Glad things are working now! Let us know if you have any questions.

Just in case you are using MAC or have your docker configuration with inet broadcast 192.168.1.255

you need to point the application to 192.168.1.15