abg / dbsake

Collection of mysql tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow customizing sandbox system-user

abg opened this issue · comments

Currently dbsake sandbox installs a sandbox owned by the user running the command. When running as root, this is similar to always enabling the SANDBOX_AS_ROOT option in mysql-sandbox. That is, the dbsake sandbox is owned by the root user, and mysqld runs at the root user. This is not ideal and should generally be avoided.

The first step here is to allow at least specifying a different system user and preserving permissions correctly. Some care should probably be taken to verify the specified user has access to the sandbox directory or bootstrapping will just fail spectacularly.

You'll also need the my.sandbox.cnf to be at least group owned by the specified system user to load plugins:

As of MySQL 5.1.33, INSTALL PLUGIN causes the server to read option (my.cnf) files just as during server startup. This enables the plugin to pick up any relevant options from those files. It is possible to add plugin options to an option file even before loading a plugin (if the loose prefix is used). It is also possible to uninstall a plugin, edit my.cnf, and install the plugin again. Restarting the plugin this way enables it to the new option values without a server restart.