Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MySQL doesn't start when a local volume is used #25

Open
cbitterfield opened this issue Nov 20, 2019 · 1 comment
Open

MySQL doesn't start when a local volume is used #25

cbitterfield opened this issue Nov 20, 2019 · 1 comment

Comments

@cbitterfield
Copy link

MySQL doesn't start when I configured a local volume for persistence.
Also: When it starts, the SQL files are created in /var/lib/mysql as root:root:

root@7a9ca27a41f7:/# service mysql status
 * MariaDB is stopped.

Usage: /etc/init.d/mysql start|stop|restart|reload|force-reload|status
root@7a9ca27a41f7:/# service mysql start
 * Starting MariaDB database server mysqld
   ...fail!

I'd recommend:

a. changing the TERM default to "TERM=xterm-256color" which is the mac default. Dumb doesn't work well on MACs. I will put a pull request for the change.

b. I'd add a variable MYSQL_BIND_ADDRESS to override the 127.0.0.1 inside.

/var/lib/mysql# ls -la

drwxr-xr-x 7 root root      224 Nov 20 17:21 .
drwxr-xr-x 1 root root     4096 Apr  3  2019 ..
-rw-rw---- 1 root root     8192 Nov 20 17:21 aria_log.00000001
-rw-rw---- 1 root root       52 Nov 20 17:21 aria_log_control
-rw-rw---- 1 root root 50331648 Nov 20 17:21 ib_logfile0
-rw-rw---- 1 root root 50331648 Nov 20 17:21 ib_logfile1
-rw-rw---- 1 root root 12582912 Nov 20 17:21 ibdata1

My Docker Start Script:

#!/bin/bash

export SITE="/Users/xxxxxx/Documents/xxxxxx"
export HTML="${SITE}/html"
export CGI_BIN="${SITE}/cgi-bin"
export SQLDATA="${SITE}/mysql/data"
export SQLLOG="${SITE}/mysql/log"
export APACHE_CONF="${SITE}/apache/conf"
export APACHE_LOGS="${SITE}/apache/logs"

export HTTP_PORT=8080
export HTTPS_PORT=4443
export MYSQL_PORT=3600

if [ "$1" = "start" ]; then
docker run --rm -p 8080:80 -p 3600:3306 -e LOG_STDOUT=true -e LOG_STDERR=true -e LOG_LEVEL=debug \
-v ${HTML}:/var/www/html \
-v ${SQLDATA}:/var/lib/mysql \
-v ${SQLLOG}:/var/log/mysql \
-v ${APACHE_LOGS}:/var/log/httpd \
fauria/lamp
fi

if [ "$1" = "stop" ]; then
docker stop `docker ps -q`
fi
echo "docker container $1"
``
@Oisann
Copy link

Oisann commented Jan 8, 2020

Run
docker exec ${CONTAINER_ID} mysql_install_db
then
docker restart ${CONTAINER_ID}

This fixed my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants