Connection Doesn't Work Running DDev

SevenDaysWalking's profile image SevenDaysWalking posted 2 weeks ago in General Permalink

Hello Ansgar,

I use DDev for development. The database connection host for ddev for the project I use is "127.0.0.1:38554" (shown when doing ddev describe). However if I add that as the host in HeidiSQL it says unknown host. It works fine in DBeaver. Does Heidi not support this format for the host?

Thank you, SDW

ansgar's profile image ansgar posted 2 weeks ago Permalink

You need to put the 38554 into the "Port" field, and use only 127.0.0.1 in the "Host/IP" field.

SevenDaysWalking's profile image SevenDaysWalking posted 2 weeks ago Permalink

Thanks for the reply. :)

No, 38554 it NOT a port number. The port number for the database is 3306.

The host is exactly as I posted it, "127.0.0.1:38554". This is standard for DDev. Like I say it works fine in DBeaver. It seems like HeidiSQL thinks it's a port number when it's not.

SevenDaysWalking's profile image SevenDaysWalking posted 2 weeks ago Permalink

Sorry, should have said "is NOT a port number".

ansgar's profile image ansgar posted 2 weeks ago Permalink

In that case I guess it's libmysql or libmariadb to blame. Not sure. HeidiSQL does not touch the host name the user entered, and passes that to mysql_real_connect(). If then you get "unknown host" it sounds logical that the library is not accepting it. I wonder if that hostname works on the command line, using `mysql --host 127.0.0.1:38554 --user xyz -p" - could you perhaps test that?

SevenDaysWalking's profile image SevenDaysWalking posted 2 weeks ago Permalink

Yes, same, Unknown Host. That's fine, it's not a big deal. I can use DBeaver and also Adminer which are fine.

Appreciate the help.

ansgar's profile image ansgar posted 2 weeks ago Permalink

I'm curious now. Of course, 3306 is the MySQL port, but what is then the "38554" part? Is it probably a port number of the ddev container or such thing? If so, you could probably use an SSH tunnel over that port to get into the container first, then use port 3306 for MySQL normally. That may be totally nonsense, I'm just curious to find a way for HeidiSQL.

SevenDaysWalking's profile image SevenDaysWalking posted 1 week ago Permalink

Well, I feel a bit embarrassed now. I'm sure I did try the port as 38554, and it didn't work, but now it does. Sorry about that.

I've only just started using DDev, this is some info:

*"Now, when connecting to the project's database from the host machine using tools, use localhost as the host and the specified host_db_port (e.g., 33085) as the port. The default username, password, and database name are typically db.

Note: For connections inside the DDEV containers (e.g., from the web container to the database container), the hostname db and the default database port (e.g., 3306 for MySQL/MariaDB, 5432 for PostgreSQL) should be used."*

So, it seems that DBeaver ignores the port value if one is set in the host? Because I have 3306 in the port box.

Anyway, appreciate the feedback. I will be sending you another donation soon btw. Your support and software is one of the best.

ansgar's profile image ansgar posted 1 week ago Permalink

Oh thanks for shedding light on that - will probably be helpful for others too.

And of course thanks a lot for your donation! 🙏

SevenDaysWalking's profile image SevenDaysWalking posted 1 week ago Permalink

You're welcome. I don't see a donor icon though and if I enter my email in Heidi it says invalid donor address.

SevenDaysWalking's profile image SevenDaysWalking posted 1 week ago Permalink

Oh, sorry I think the payment email was a different one, it works now.

Please login to leave a reply, or register at first.