I compile a 5.7 MySQL database from source into a custom directory and use mysqld --initialize
to initialize the database.
This works fine as long as there is no MySQL installed on the main system, or when I use mv /etc/mysql/my.cnf /etc/mysql/my.cnf_backup
to get rid of the system-wide file, but of course that is a terrible workaround that breaks the system-wide mysql installation.
If a /etc/mysql/my.cnf
is present, the initialization fails obviously as the paths are all wrong.
mysqld --initialize
always seems to prefer /etc/mysql/my.cnf
and ignores any file I specify on the command line with --defaults-file
. It does however use single parameters that are specified on the command line (so it may work if I translate my complete my.cnf file into command line arguments, but that again is not a good solution and creates other problems)
Of course the whole point why I build from source into a custom directory is because I want it independent from any things that are installed on the main system.
Is there a way to let mysqld --initialize
ignore /etc/mysql/my.cnf
?