HUB
Sign inSign up

cytopia/mysql-5.5

By cytopia

•Updated almost 9 years ago

MySQL 5.5 on CentOS 7

Image
8

1M+

cytopia/mysql-5.5 repository overview

⁠MySQL 5.5 Docker

Latest build: 2017-09-28

Build Status

cytopia/mysql-5.5

mysql 5.5 | mysql 5.6⁠ | mysql 5.7⁠ | mysql 8.0⁠ | mariadb 5.5⁠ | mariadb 10.0⁠ | mariadb 10.1⁠ | mariadb 10.2⁠ | mariadb 10.3⁠ | percona 5.5⁠ | percona 5.6⁠ | percona 5.7⁠


MySQL 5.5 Docker on CentOS 7

Devilbox

This docker image is part of the devilbox⁠


⁠Options

⁠Environmental variables
⁠Required environmental variables
VariableTypeDescription
MYSQL_ROOT_PASSWORDstringMySQL root user password of either existing database or in case it does not exist it will initialize the new database with the given password.
⁠Optional environmental variables
VariableTypeDefaultDescription
DEBUG_COMPOSE_ENTRYPOINTbool0Show shell commands executed during start.
Value: 0 or 1
TIMEZONEstringUTCSet docker OS timezone.
Example: Europe/Berlin
MYSQL_SOCKET_DIRstring/var/sock/mysqldPath inside the docker to the socket directory.

Used to separate socket directory from data directory in order to mount it to the docker host or other docker containers.

Mount this directory to a PHP container and be able to use mysqli_connect with localhost.
MYSQL_GENERAL_LOGbool0Turn on or off general logging
Corresponds to mysql config: general-log
Value: 0 or 1
⁠Default mount points
DockerDescription
/var/lib/mysqlMySQL data dir
/var/log/mysqlMySQL log dir
/var/sock/mysqldMySQL socket dir
/etc/mysql/conf.dMySQL configuration directory (used to overwrite MySQL config)
/etc/mysql/docker-default.dMySQL configuration directory (used to overwrite MySQL config)
⁠Default ports
DockerDescription
3306MySQL listening Port

⁠Usage

1. Listen on loopback interface only

$ docker run -i \
    -p 127.0.0.1:3306:3306 \
    -e MYSQL_ROOT_PASSWORD=my-secret-pw \
    -t cytopia/mysql-5.5

# Access MySQL from your host computer
$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e 'show databases;'

2. Enable logging

Enable logging and mount the log directory to your host to ~tmp/mysql-log

$ docker run -i \
    -p 127.0.0.1:3306:3306 \
    -v ~tmp/mysql-log:/var/log/mysql \
    -e MYSQL_ROOT_PASSWORD=my-secret-pw \
    -e MYSQL_GENERAL_LOG=1 \
    -t cytopia/mysql-5.5

# Access MySQL from your host computer
$ mysql --user=root --password=my-secret-pw --host=127.0.0.1 -e 'show databases;'

3. Mount MySQL socket to the host

Use MySQL socket for localhost connections through the socket. No need to expose the MySQL port to the host in this case.

$ docker run -i \
    -v ~tmp/mysql-sock:/var/sock/mysqld \
    -e MYSQL_ROOT_PASSWORD=my-secret-pw \
    -t cytopia/mysql-5.5

# Access MySQL from your host computer via socket
$ mysql --user=root --password=my-secret-pw --socket=/var/sock/mysqld/mysqld.sock -e 'show databases;'

4. Overwrite configuration

You can also add any configuration settings prior startup to MySQL.

# Create local config with buffer overwrite
$ printf "[mysqld]\n%s\n" "key_buffer = 500M" > ~/tmp/mysqld_config/buffer.cnf

$ docker run -i \
    -p 127.0.0.1:3306:3306 \
    -v ~/tmp/mysqld_config:/etc/mysql/conf.d \
    -e MYSQL_ROOT_PASSWORD=my-secret-pw \
    -t cytopia/mysql-5.5

⁠MySQL Configuration overview

Configuration files inside this docker are read in the following order:

OrderFileDescription
1/etc/my.cnfOperating system default
2/etc/mysql/conf.d/Custom configuration (level 1). Can be mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the devilbox for its base configuration)
3/etc/mysql/docker-default.d/*.cnfCustom configuration (level 2). Can be mounted to provide custom *.cnf files which can overwrite anything of the above. (used by the devilbox to allow custom user-defined configuration overwriting the default devilbox settings.

⁠Modules

[Version]

mysqld Ver 5.5.57 for Linux on x86_64 (MySQL Community Server (GPL))

Tag summary
Recent tags
Content type
Image
Digest
Size
246.4 MB
Last updated
almost 9 years ago
docker pull cytopia/mysql-5.5:latest