This is an MySQL Docker image used to launch a MySQL service on Nanobox. To use this image, add a data component to your boxfile.yml
with the nanobox/mysql
image specified:
data.db:
image: nanobox/mysql
MySQL components are configured in your boxfile.yml
. All available configuration options are outlined below.
plugins
event_scheduler
max_connections
thread_stack
myisam_recover
max_allowed_packet
max_join_size
table_open_cache
query_cache_limit
allow_suspicious_udfs
ansi
audit_log
ft_max_word_len
ft_min_word_len
ft_query_expansion_limit
ft_stopword_file
Custom Users/Permissions/Databases
data.db:
image: nanobox/mysql
config:
version: 5.5
plugins:
- federated
- audit_log
event_scheduler: 'Off'
max_connections: 1024
thread_stack: '256K'
myisam_recover: 'DEFAULT'
max_allowed_packet: '16M'
max_join_size: 9223372036854775807
table_open_cache: 64
query_cache_limit: '1M'
allow_suspicious_udfs: 'Off'
ansi: 'Off'
audit_log: 'On'
ft_max_word_len: 84
ft_min_word_len: 4
ft_query_expansion_limit: 20
ft_stopword_file: ' '
users:
- username: root
meta:
privileges:
- privilege: ALL PRIVILEGES
'on': "*.*"
with_grant: true
- username: nanobox
meta:
privileges:
- privilege: ALL PRIVILEGES
'on': gonano.*
with_grant: true
- privilege: ALL PRIVILEGES
'on': testing.*
with_grant: true
- privilege: ALL PRIVILEGES
'on': blah.*
with_grant: true
- privilege: PROCESS
'on': "*.*"
with_grant: false
- privilege: SUPER
'on': "*.*"
with_grant: false
databases:
- gonano
- testing
When configuring MySQL in your Boxfile, you can define which of the following versions you'd like to use.
- 5.5
- 5.6
- 5.7
Note: Due to version compatibility constraints, MySQL versions cannot be changed after the service is created. To use a different version, you'll have to create a new MySQL service and manually migrate data.
# default setting
data.db:
image: nanobox/mysql
config:
version: 5.6
This allows you to specify what MySQL plugins to load into your database service. The following plugins are available:
- archive
- blackhole
- federated
- audit_log
data.db:
image: nanobox/mysql
config:
plugins:
- federated
Note: When using the audit_log
plugin, you must also specify a audit_log
setting in your Boxfile.
This enables or disables MySQL's event scheduler.
Note: Even though event_scheduler
's default is "Off", it can still be enabled through a SQL query in your database. Setting it to "On" just enables the event scheduler when the database is provisioned.
# default setting
data.db:
image: nanobox/mysql
config:
event_scheduler: 'Off'
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
max_connections: 1024
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
thread_stack: '256K'
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
myisam_recover: 'DEFAULT'
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
max_allowed_packet: '16M'
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
max_join_size: 9223372036854775807
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
table_open_cache: 64
View dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
query_cache_limit: '1M'
View the dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
allow_suspicious_udfs: 'Off'
View the dev.mysql.com documentation for definition and configuration options.
# default setting
data.db:
image: nanobox/mysql
config:
ansi: 'Off'
View the dev.mysql.com documentation for definition and configuration details. Below are the following options:
- on
- off
- force
- force_plus_permanent
Note: In order to specify a audit_log
setting, you must also include the audit_log
mysql plugin in your Boxfile.
data.db:
image: nanobox/mysql
config:
audit_log: 'On'
plugins:
- audit_log
View the dev.mysql.com documentation for definition and configuration options.
data.db:
image: nanobox/mysql
config:
ft_max_word_len: 84
View the dev.mysql.com documentation for definition and configuration options.
data.db:
image: nanobox/mysql
config:
ft_min_word_len: 4
View the dev.mysql.com documentation for definition and configuration options.
data.db:
image: nanobox/mysql
config:
ft_query_expansion_limit: 20
View the dev.mysql.com documentation for definition and configuration options.
data.db:
image: nanobox/mysql
config:
ft_stopword_file: ' '
You can create custom users with custom permissions as well as additional databases.
data.mysql:
image: nanobox/mysql
config:
users:
- username: root
meta:
privileges:
- privilege: ALL PRIVILEGES
'on': "*.*"
with_grant: true
- username: nanobox
meta:
privileges:
- privilege: ALL PRIVILEGES
'on': gonano.*
with_grant: true
- privilege: ALL PRIVILEGES
'on': testing.*
with_grant: true
- privilege: ALL PRIVILEGES
'on': blah.*
with_grant: true
- privilege: PROCESS
'on': "*.*"
with_grant: false
- privilege: SUPER
'on': "*.*"
with_grant: false
databases:
- gonano
- testing
For each custom user specified, Nanobox will generate an environment variable for the user's password using the following pattern:
# Pattern
COMPONENT_ID_USERNAME_PASS
# Examples
## Custom user config 1
data.mysql:
config:
users:
- username: myuser
## Generated password evar 1
DATA_MYSQL_MYUSER_PASS
## Custom user config 2
data.db:
config:
users:
- username: dbuser
## Generated password evar 2
DATA_DB_DBUSER_PASS
This is a MySQL Docker image provided by Nanobox. If you need help with this image, you can reach out to us in the #nanobox IRC channel. If you are running into an issue with the image, feel free to create a new issue on this project.
Mozilla Public License, version 2.0