Adding MySQL to your Shell
devbox add mysql80, or in your devbox.json add
devbox add mysql57
You can manually add the MySQL Plugin to your devbox.json by adding it to your include list:
devbox search mysql80 or devbox search mysql57. You can also view the available versions
on Nixhub
MySQL Plugin Support
Devbox will automatically create the following configuration when you rundevbox add mysql80 or
devbox add mysql57. You can view the full configuration by running devbox info mysql
Services
- mysql
devbox services up|stop mysql to start or stop the MySQL Server.
Environment Variables
Files
The following helper file will be created in your project directory:- {PROJECT_DIR}/devbox.d/mysql/my.cnf
.devbox/virtenv folder:
- mysql/flake.nix
- mysql/setup_db.sh
- mysql/process-compose.yaml
Notes
- This plugin wraps mysqld to work in your local project. For more information, see the
flake.nixcreated in your.devbox/virtenv/mysqlfolder. - This plugin will create a new database for your project in
MYSQL_DATADIRif one doesn’t exist on shell init. - You can use
mysqldto manually start the server, andmysqladmin -u root shutdownto manually stop it .sockfilepath can only be maximum 100 characters long. You can point to a different path by setting theMYSQL_UNIX_PORTenv variable in yourdevbox.jsonas follows:
Disabling the MySQL PLugin
You can disable the built-in MySQL plugin usingdevbox add mysql80 --disable-plugin, or by setting
the disable_plugin field to true in your package definition: