You're certainly exposing all the edge-cases! 🤪 You get the beta-tester of the month award haha.
The default location for Indigo MySQL's data directory is inside the ~/.indigo
path; is there some other reason the default config doesn't work in the context of iCloud?
Regardless, when you start up a MySQL service, Indigo first checks whether it needs to initialise that mysql's data directory. The logic it uses to determine that at present is the issue here — it's currently "functional placeholder code": it checks for the existence of {{dataDirectory}}/sys/sys_config.ibd
, that being one of the files that will definitely exist when you have initialised mysql.
However since you are overriding the datadir
, {{dataDirectory}}/sys/sys_config.ibd
won't exist, and Indigo will try to initialise MySQL.
I always anticipated the need for a better check than the filesystem one described above. The real issue is there's no mysql command that simply checks status; they all require mysqld to actually be running. However there are a couple of options, I think. I'm very interested in your feedback on them:
1) just run mysqld --initialize-insecure
prior to every MySQL launch. As per the MySQL docs, "the command that initializes the data directory does not overwrite any existing mysql database tables, so it is safe to run in any circumstances."
2) attempt to run something like mysqld --user=root
. If the data directory is not initialised, that command returns an error of some kind (mysqld: Table 'mysql.plugin' doesn't exist
) which I could use to flag the need for initialisation.
3) blindly attempt to start up mysqld and if it fails to start, check why. In my testing without a valid data directory it threw Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
for me.
I fear 1) might have unintended consequences, but the docs do state that not to be the case.
I dislike 2) because, like the current solution, it feels like it relies on some preconceptions about the data directory.
So I'm leaning towards 3) at present.