Skip to content

Feature request: custom server settings for MySQL and MariaDB (a my.cnf instead of --no-defaults) #88

Description

@sloan58

What

A way to start MySQL (and MariaDB) with custom server settings, the way Postgres already reads postgresql.conf from its data directory.

Why

My app's production database (RDS MySQL 8.4) runs with two non-default settings that its search depends on:

ngram_token_size = 3
innodb_ft_enable_stopword = 0

ngram_token_size is read-only: it can only be set when the server starts. A migration in the app refuses to build its FULLTEXT indexes on a server where it isn't 3, so I can't use Flock's MySQL for local development.

sqlSpec in internal/catalog/kinds.go starts the server with --no-defaults, which turns off every way of configuring it:

  • option files (my.cnf, --defaults-extra-file) are not read
  • SET PERSIST / SET PERSIST_ONLY values, saved in mysqld-auto.cnf in the data directory, are not loaded either

To reproduce on Flock 1.0.0 with MySQL 8.4.13:

SET PERSIST_ONLY ngram_token_size = 3;
SET PERSIST innodb_ft_enable_stopword = 0;
-- flock restart
SELECT @@ngram_token_size, @@innodb_ft_enable_stopword;  -- 2, 1
SELECT variable_name, variable_source FROM performance_schema.variables_info
 WHERE variable_name IN ('ngram_token_size', 'innodb_ft_enable_stopword');  -- both COMPILED

mysqld-auto.cnf holds the values and the server did restart, but they aren't applied. The same applies to any setting an app needs to match production: sql_mode, max_allowed_packet, innodb_buffer_pool_size, lower_case_table_names, and so on.

Possible approach

Replace --no-defaults with --defaults-file=<data dir>/my.cnf:

  • Flock creates the file the first time it starts the server (a [mysqld] section with a commented hint) and never overwrites it afterwards.
  • --defaults-file still ignores /etc/my.cnf, Homebrew's /opt/homebrew/etc/my.cnf and ~/.my.cnf, which I assume is why --no-defaults is there.
  • It also lets MySQL load mysqld-auto.cnf, so SET PERSIST works as documented.
  • Flock's own flags (--basedir, --datadir, --bind-address, --port, --socket) stay on the command line and take priority over the file, so a user's settings can't break Flock.
  • Each version has its own data directory, so each version gets its own file, like postgresql.conf does today.
  • MariaDB uses the same sqlSpec, so it gets this too.
  • --defaults-file has to be the first argument, and the file must exist before the server starts.

Then flock restart applies any edits to the file.

Happy to send a PR if this fits the project.

Activity

  1. added
    help wanted
    and removed on Nov 3, 2026
  2. onairmarc commented on Nov 3, 2026

    @onairmarc
    Member

    Hey @sloan58! Just assigned the issue to you! Workflows will now allow you to open a PR. Thanks for submitting this!

  3. added this to the v1.x milestone on Nov 3, 2026
  4. added theissue type on Nov 3, 2026
  5. sloan58 commented on Nov 4, 2026

    @sloan58
    ContributorAuthor

    Thanks, @onairmarc! PR 105 was just submitted. Let me know if you need any further changes.

  6. added a commit that references this issue on Nov 7, 2026
    d9e67db
  7. removed this from the v1.1.0 milestone on Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

help wanted

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions