Skip to content

Connecting to socket did not work after support for ipv6 in 5.4.0#1199

Open
magnusvin wants to merge 2 commits intovrana:masterfrom
magnusvin:patch-2
Open

Connecting to socket did not work after support for ipv6 in 5.4.0#1199
magnusvin wants to merge 2 commits intovrana:masterfrom
magnusvin:patch-2

Conversation

@magnusvin
Copy link

@magnusvin magnusvin commented Oct 27, 2025

image

The commit f921dafa breaks behavior that previously worked.

I’ve added comments in the commit messages explaining what each change does and split the commits accordingly.

When the host is empty due to :/unix_socket_path, I now check for that and omit the host in the DSN.

The behavior from this line has been moved into the host_port function.

Because 5.4.0 introduced breaking behavior on my part, I manually fixed the adminer.php file like this:
image

Shouldn't the CI tests pass? I agree that I should separate the PRs as suggested in #1183.

@magnusvin magnusvin changed the title Patch 2 Connecting to socket did not work after support for ipv6 in 5.4.0 Oct 27, 2025
@vrana vrana added the Waiting label Oct 28, 2025
@vrana
Copy link
Owner

vrana commented Oct 28, 2025

Your first commit breaks connecting to IPv6. Describe your input to the server field, the expected behavior and the actual behavior.

Allows server to be ":/socket/mysql.sock", host will be empty and "port" (socket) will be path to socket. This will also work with "proxy:/socket/mysql.sock" and host will be "proxy"
example.com and example.com:3306 will work as expected
@magnusvin
Copy link
Author

@vrana You are correct — sorry about that!

I have made a new change and tested the following combinations:

Server DSN
[fd00:dead:beef::3] mysql:charset=utf8;host=fd00:dead:beef::3
[fd00:dead:beef::3]:3306 mysql:charset=utf8;host=fd00:dead:beef::3;port=3306
[fd00:dead:beef::3]:/var/www/mysql.sock mysql:charset=utf8;host=fd00:dead:beef::3;unix_socket=/var/www/mysql.sock
[::1] mysql:charset=utf8;host=::1
[::1]:3306 mysql:charset=utf8;host=::1;port=3306
[::1]:/var/www/mysql.sock mysql:charset=utf8;host=::1;unix_socket=/var/www/mysql.sock
:/var/www/mysql.sock mysql:charset=utf8;unix_socket=/var/www/mysql.sock
localhost:/var/www/mysql.sock mysql:charset=utf8;host=localhost;unix_socket=/var/www/mysql.sock
example.com mysql:charset=utf8;host=example.com
example.com:3306 mysql:charset=utf8;host=example.com;port=3306
example.com:/var/www/mysql.sock mysql:charset=utf8;host=example.com;unix_socket=/var/www/mysql.sock
127.0.0.1 mysql:charset=utf8;host=127.0.0.1
127.0.0.1:3306 mysql:charset=utf8;host=127.0.0.1;port=3306
127.0.0.1:/var/www/mysql.sock mysql:charset=utf8;host=127.0.0.1;unix_socket=/var/www/mysql.sock
db-master mysql:charset=utf8;host=db-master
db-master:3306 mysql:charset=utf8;host=db-master;port=3306

Everything should now work as expected. IPv4, IPv6 and domain with port or socket works.

This is specifically to the first commit that was wrong (host_port) and should now be equivalent to the old behaviour before 5.4.0.

@vrana vrana force-pushed the master branch 2 times, most recently from e3fa3eb to 9d1451e Compare February 7, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants