Skip to content

mariadb (but not mysql) does not respect the MYSQL_UNIX_PORT env variable #2522

Open
@jefft

Description

@jefft

What happened?

To replicate:

cd /tmp
devbox create mariadbtest --template mariadb
cd mariadbtest
devbox run bash -c 'echo $MYSQL_UNIX_PORT'  # Prints /tmp/mariadbtest/.devbox/virtenv/mariadb/run/mysql.sock
# Note: do not start mariadb. This means we expect the connect attempt to fail
devbox run mariadb

The output ends with:

ERROR 2002 (HY000): Can't connect to local server through socket '/run/mysqld/mysqld.sock' (2)

This shows that the socket path, MYSQL_UNIX_PORT, is not being read.

To show that this is buggy, run the exact same steps with mysql instead of mariadb:

cd /tmp
devbox create mysqltest --template mysql
cd mysqltest
devbox run bash -c 'echo $MYSQL_UNIX_PORT'  # Prints /tmp/mysqltest/.devbox/virtenv/mysql80/run/mysql.sock
# Note: do not start mysql. This means we expect the connect attempt to fail
devbox run mysql

This prints

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysqltest/.devbox/virtenv/mysql80/run/mysql.sock' (2)

which is correct - the MYSQL_UNIX_PORT socket is being used.


Perhaps this is an upstream mariadb bug. A fix/workaround would be for Devbox's mariadb flake.nix to generate mysql and mariadb wrappers that set --socket=$MYSQL_UNIX_PORT.

Steps to reproduce

No response

Command

No response

devbox.json

Devbox version

0.14.0

Nix version

nix (Nix) 2.18.5

What system does this bug occur on?

Linux (x86-64)

Debug logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssue needs triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions