Skip to content

nanobox-io/nanobox-docker-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MySQL Build Status Image

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 Configuration Options

MySQL components are configured in your boxfile.yml. All available configuration options are outlined below.

Quick Links

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

Overview of MySQL Boxfile Settings

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

Version

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.

version

# default setting
data.db:
  image: nanobox/mysql
  config:
    version: 5.6

Plugins

This allows you to specify what MySQL plugins to load into your database service. The following plugins are available:

  • archive
  • blackhole
  • federated
  • audit_log

plugins

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.

Event Scheduler

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.

event_scheduler

# default setting
data.db:
  image: nanobox/mysql
  config:
    event_scheduler: 'Off'

Max Connections

View dev.mysql.com documentation for definition and configuration options.

max_connections

# default setting
data.db:
  image: nanobox/mysql
  config:
    max_connections: 1024

Thread Stack

View dev.mysql.com documentation for definition and configuration options.

thread_stack

# default setting
data.db:
  image: nanobox/mysql
  config:
    thread_stack: '256K'

MyISAM Recover

View dev.mysql.com documentation for definition and configuration options.

myisam_recover

# default setting
data.db:
  image: nanobox/mysql
  config:
    myisam_recover: 'DEFAULT'

Max Allowed Packet

View dev.mysql.com documentation for definition and configuration options.

myisam_recover

# default setting
data.db:
  image: nanobox/mysql
  config:
    max_allowed_packet:  '16M'

Max Join Size

View dev.mysql.com documentation for definition and configuration options.

max_join_size

# default setting
data.db:
  image: nanobox/mysql
  config:
    max_join_size: 9223372036854775807

Table Open Cache

View dev.mysql.com documentation for definition and configuration options.

table_open_cache

# default setting
data.db:
  image: nanobox/mysql
  config:
    table_open_cache: 64

Query Cache Limit

View dev.mysql.com documentation for definition and configuration options.

query_cache_limit

# default setting
data.db:
  image: nanobox/mysql
  config:
    query_cache_limit: '1M'

Allow Suspicious UDFs

View the dev.mysql.com documentation for definition and configuration options.

allow_suspicious_udfs

# default setting
data.db:
  image: nanobox/mysql
  config:
    allow_suspicious_udfs: 'Off'

ANSI

View the dev.mysql.com documentation for definition and configuration options.

ansi

# default setting
data.db:
  image: nanobox/mysql
  config:
    ansi: 'Off'

Audit Log

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.

audit_log

data.db:
  image: nanobox/mysql
  config:
    audit_log: 'On'
    plugins:
      - audit_log

FULLTEXT Maximum Word Length

View the dev.mysql.com documentation for definition and configuration options.

ft_max_word_len

data.db:
  image: nanobox/mysql
  config:
    ft_max_word_len: 84

FULLTEXT Minimum Word Length

View the dev.mysql.com documentation for definition and configuration options.

ft_min_word_len

data.db:
  image: nanobox/mysql
  config:
    ft_min_word_len: 4

FULLTEXT Query Expansion Limit

View the dev.mysql.com documentation for definition and configuration options.

ft_query_expansion_limit

data.db:
  image: nanobox/mysql
  config:
    ft_query_expansion_limit: 20

FULLTEXT Stopword File

View the dev.mysql.com documentation for definition and configuration options.

ft_stopword_file

data.db:
  image: nanobox/mysql
  config:
    ft_stopword_file: ' '

Custom Users/Permissions/Databases

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

Help & Support

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.

License

Mozilla Public License, version 2.0