Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the nix path for mysql/mariadb 'basedir'. Fixes #2524 #2525

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jefft
Copy link

@jefft jefft commented Feb 17, 2025

Summary

As described on #2524, mysqld are using the local /usr for basedir (e.g. reading /usr/lib/mysql/plugins if present), when it should be using the nix equivalent.

How was it tested?

Warning: this is untested. I don't know how to recompile flake.nix, so I cheated and edited the mysqld wrapper with sudo vim $(which mysqld). This patch may be wrong, e.g. I'm not sure if $out will be expanded in those single-quotes.

But if the patch does what I hope, this is the effect it should have:

cd /tmp
devbox create mysqltest --template mysql
devbox run mysqld --verbose --help | grep ^basedir

With this patch, the command above should print something like:

basedir                                                      /nix/store/15pzxq00jcraacaxancf3zm6h444azpm-mysql-wrapped/

previously it would print:

basedir                                                      /usr/

Also, one can fully launch mysqld, connect with mysql and show the basedir with:

mysql> SHOW VARIABLES LIKE '%dir';
+-----------------------------+---------------------------------------------------------------------------------+
| Variable_name               | Value                                                                           |
+-----------------------------+---------------------------------------------------------------------------------+
| basedir                     | /nix/store/15pzxq00jcraacaxancf3zm6h444azpm-mysql-wrapped/                      |
| character_sets_dir          | /nix/store/15pzxq00jcraacaxancf3zm6h444azpm-mysql-wrapped/share/mysql/charsets/ |
| datadir                     | /tmp/mysqltest/.devbox/virtenv/mysql80/data/                                    |
| innodb_data_home_dir        |                                                                                 |
| innodb_doublewrite_dir      |                                                                                 |
| innodb_log_group_home_dir   | ./                                                                              |
| innodb_temp_tablespaces_dir | ./#innodb_temp/                                                                 |
| innodb_tmpdir               |                                                                                 |
| lc_messages_dir             | /nix/store/15pzxq00jcraacaxancf3zm6h444azpm-mysql-wrapped/share/mysql/          |
| plugin_dir                  | /nix/store/15pzxq00jcraacaxancf3zm6h444azpm-mysql-wrapped/lib/mysql/plugin/     |
| replica_load_tmpdir         | /tmp                                                                            |
| slave_load_tmpdir           | /tmp                                                                            |
| tmpdir                      | /tmp                                                                            |
+-----------------------------+---------------------------------------------------------------------------------+
13 rows in set (0.00 sec)

The basedir and related paths are now correctly pointing to /nix/store paths, and everything still works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant