Custom docker official mariadb image - mysql

I intended to create a database based on mariadb within a Dockerfile but failed.
Dockerfile content as following:
FROM mariadb
RUN mysql -uroot --password="test" -e "CREATE DATABASE IF NOT EXISTS mymariadb;"
then, when I build customed image with command docker build -t testdb .
it fails with following error:
docker#docker-virtual-machine:~$ docker build -t tttt .
Sending build context to Docker daemon 32.26kB
Step 1/2 : FROM mariadb
---> 2bdd97ca79d9
Step 2/2 : RUN mysql -uroot --password="test" -e "CREATE DATABASE IF NOT EXISTS mymariadb;"
---> Running in 80339dc97c2e
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
The command '/bin/sh -c mysql -uroot --password="test" -e "CREATE DATABASE IF NOT EXISTS mymariadb;"' returned a non-zero code: 1
docker#docker-virtual-machine:~$
And then I follow #Sebastian advices but find the database is not created, details as following:
docker#docker-virtual-machine:~/test$ ls
Dockerfile init.sql
docker#docker-virtual-machine:~/test$ cat init.sql
CREATE DATABASE IF NOT EXISTS mydb;
docker#docker-virtual-machine:~/test$
docker#docker-virtual-machine:~/test$ cat Dockerfile
FROM mariadb
COPY init.sql /docker-entrypoint-initdb.d/
CMD ["mysqld"]
docker#docker-virtual-machine:~/test$ docker build -t mydb .
Sending build context to Docker daemon 3.072kB
Step 1/3 : FROM mariadb
---> 2bdd97ca79d9
Step 2/3 : COPY init.sql /docker-entrypoint-initdb.d/
---> 59fa0f173d93
Step 3/3 : CMD ["mysqld"]
---> Running in e605ae1fda5b
Removing intermediate container e605ae1fda5b
---> 94b98e45dc05
Successfully built 94b98e45dc05
Successfully tagged mydb:latest
docker#docker-virtual-machine:~/test$ docker run -p 3306:3306/tcp -v /my/own/dat adir1:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=test123 mydb
2019-01-26 17:30:21 0 [Note] mysqld (mysqld 10.3.12-MariaDB-1:10.3.12+maria~bion ic) starting as process 1 ...
2019-01-26 17:30:21 0 [Note] InnoDB: Using Linux native AIO
2019-01-26 17:30:21 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtin s
2019-01-26 17:30:21 0 [Note] InnoDB: Uses event mutexes
2019-01-26 17:30:21 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-01-26 17:30:21 0 [Note] InnoDB: Number of pools: 1
2019-01-26 17:30:21 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-01-26 17:30:21 0 [Note] InnoDB: Initializing buffer pool, total size = 256M , instances = 1, chunk size = 128M
2019-01-26 17:30:21 0 [Note] InnoDB: Completed initialization of buffer pool
2019-01-26 17:30:21 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-01-26 17:30:21 0 [Note] InnoDB: 128 out of 128 rollback segments are active .
2019-01-26 17:30:21 0 [Note] InnoDB: Creating shared tablespace for temporary ta bles
2019-01-26 17:30:21 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Phys ically writing the file full; Please wait ...
2019-01-26 17:30:21 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-01-26 17:30:21 0 [Note] InnoDB: 10.3.12 started; log sequence number 163095 0; transaction id 21
2019-01-26 17:30:21 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ ib_buffer_pool
2019-01-26 17:30:21 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-01-26 17:30:21 0 [Note] InnoDB: Buffer pool(s) load completed at 190126 17: 30:21
2019-01-26 17:30:21 0 [Note] Server socket created on IP: '::'.
2019-01-26 17:30:21 0 [Warning] 'proxies_priv' entry '#% root#566af8cb98ef' igno red in --skip-name-resolve mode.
2019-01-26 17:30:21 0 [Note] Reading of all Master_info entries succeded
2019-01-26 17:30:21 0 [Note] Added new Master_info '' to hash table
2019-01-26 17:30:21 0 [Note] mysqld: ready for connections.
Version: '10.3.12-MariaDB-1:10.3.12+maria~bionic' socket: '/var/run/mysqld/mysq ld.sock' port: 3306 mariadb.org binary distribution

The official MariaDB image uses CMD ["mysqld"] instead of RUN mysql. So
FROM mariadb
COPY ./my-initial.sql /docker-entrypoint-initdb.d/
CMD ["mysqld"]
should do the trick.
To execute initial SQL see this section of the image docs.

Related

MySQL docker: Import schema file with error: inet addr:'| cut -d: -f2 | awk '{ print $1}'", "commandName": "IP"}], "clamAvInt'

I am working with MySQL docker image version 5.7 with initialize the data by the schema file but got some error can't solve.
My docker command line is:
docker run --name mysql -e MYSQL_ROOT_PASSWORD='abc123' -v /Users/jenkins/Desktop/irms:/docker-entrypoint-initdb.d mysql:5.7
and get the error, the log as below:
$ docker run --name mysql -e MYSQL_ROOT_PASSWORD='abc123' -v /Users/jenkins/Desktop/irms:/docker-entrypoint-initdb.d mysql:5.7
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.33-1debian10 started.
2021-03-17 02:05:15+00:00 [Note] [Entrypoint]: Initializing database files
2021-03-17T02:05:15.606058Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-17T02:05:15.756090Z 0 [Warning] InnoDB: New log files created, LSN=45790
2021-03-17T02:05:15.779384Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2021-03-17T02:05:15.837663Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 373d4ffb-86c5-11eb-8780-0242ac110002.
2021-03-17T02:05:15.839186Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-03-17T02:05:16.450734Z 0 [Warning] CA certificate ca.pem is self signed.
2021-03-17T02:05:16.576740Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Database files initialized
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Starting temporary server
2021-03-17 02:05:18+00:00 [Note] [Entrypoint]: Waiting for server startup
2021-03-17T02:05:18.819727Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2021-03-17T02:05:18.820623Z 0 [Note] mysqld (mysqld 5.7.33) starting as process 78 ...
2021-03-17T02:05:18.822725Z 0 [Note] InnoDB: PUNCH HOLE support available
2021-03-17T02:05:18.822772Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2021-03-17T02:05:18.822783Z 0 [Note] InnoDB: Uses event mutexes
2021-03-17T02:05:18.822789Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2021-03-17T02:05:18.822795Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-03-17T02:05:18.822800Z 0 [Note] InnoDB: Using Linux native AIO
2021-03-17T02:05:18.823072Z 0 [Note] InnoDB: Number of pools: 1
2021-03-17T02:05:18.823301Z 0 [Note] InnoDB: Using CPU crc32 instructions
2021-03-17T02:05:18.824551Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2021-03-17T02:05:18.829149Z 0 [Note] InnoDB: Completed initialization of buffer pool
2021-03-17T02:05:18.830692Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2021-03-17T02:05:18.841912Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2021-03-17T02:05:18.846985Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-03-17T02:05:18.847098Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-03-17T02:05:18.862891Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-03-17T02:05:18.863475Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2021-03-17T02:05:18.863521Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2021-03-17T02:05:18.863960Z 0 [Note] InnoDB: Waiting for purge to start
2021-03-17T02:05:18.914486Z 0 [Note] InnoDB: 5.7.33 started; log sequence number 2746831
2021-03-17T02:05:18.915203Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-03-17T02:05:18.915523Z 0 [Note] Plugin 'FEDERATED' is disabled.
2021-03-17T02:05:18.916967Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210317 2:05:18
2021-03-17T02:05:18.920098Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-03-17T02:05:18.920168Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-03-17T02:05:18.920570Z 0 [Warning] CA certificate ca.pem is self signed.
2021-03-17T02:05:18.920635Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-03-17T02:05:18.922497Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2021-03-17T02:05:18.926990Z 0 [Note] Event Scheduler: Loaded 0 events
2021-03-17T02:05:18.927219Z 0 [Note] mysqld: ready for connections.
Version: '5.7.33' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
2021-03-17 02:05:19+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2021-03-17 02:05:20+00:00 [Note] [Entrypoint]: /usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/IRMSDB_2021-03-09.sql
ERROR 1064 (42000) at line 287: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'inet addr:'| cut -d: -f2 | awk '{ print $1}'", "commandName": "IP"}], "clamAvInt' at line 5
I checked my schema file and no idea what the error exactly and no idea how to fix it.
My schema file is exported from Sequel Pro.
Could you kindly provide some idea to solve the problem?
Thanks very much.
Just attached my schema file below, and please change the extension name from jpg to SQL.
Click here to download: MySQL schema file

Docker mysql container does not allow remote connection

I have an error Access denied for user 'bonus_user'#'my-ip' (using password: YES) when trying to connect from my mysql client to dockerized mysql server on remote machine
My docker-compose file:
bonus_db:
container_name: bonus_db
image: mysql:5.7
command: --default-authentication-plugin=mysql_native_password
restart: unless-stopped
ports:
- "3306:3306"
environment:
MYSQL_USER: bonus_user
MYSQL_PASSWORD: bonus_pass
MYSQL_DATABASE: bonus_db
MYSQL_ROOT_PASSWORD: root_pass
volumes:
- /var/lib/volumes/bonusdata:/var/lib/mysql
Here's also log of container starting:
bonus_db | 2020-11-14 15:06:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
bonus_db | 2020-11-14 15:06:05+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
bonus_db | 2020-11-14 15:06:05+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
bonus_db | 2020-11-14T15:06:06.470897Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
bonus_db | 2020-11-14T15:06:06.480712Z 0 [Note] mysqld (mysqld 5.7.31) starting as process 1 ...
bonus_db | 2020-11-14T15:06:06.502124Z 0 [Note] InnoDB: PUNCH HOLE support available
bonus_db | 2020-11-14T15:06:06.504807Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
bonus_db | 2020-11-14T15:06:06.504851Z 0 [Note] InnoDB: Uses event mutexes
bonus_db | 2020-11-14T15:06:06.504878Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
bonus_db | 2020-11-14T15:06:06.504894Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
bonus_db | 2020-11-14T15:06:06.504906Z 0 [Note] InnoDB: Using Linux native AIO
bonus_db | 2020-11-14T15:06:06.505684Z 0 [Note] InnoDB: Number of pools: 1
bonus_db | 2020-11-14T15:06:06.506021Z 0 [Note] InnoDB: Using CPU crc32 instructions
bonus_db | 2020-11-14T15:06:06.522229Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
bonus_db | 2020-11-14T15:06:06.548073Z 0 [Note] InnoDB: Completed initialization of buffer pool
bonus_db | 2020-11-14T15:06:06.554315Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
bonus_db | 2020-11-14T15:06:06.568903Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
bonus_db | 2020-11-14T15:06:06.603166Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
bonus_db | 2020-11-14T15:06:06.605892Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
bonus_db | 2020-11-14T15:06:06.654737Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
bonus_db | 2020-11-14T15:06:06.656736Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
bonus_db | 2020-11-14T15:06:06.656771Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
bonus_db | 2020-11-14T15:06:06.657961Z 0 [Note] InnoDB: Waiting for purge to start
bonus_db | 2020-11-14T15:06:06.708340Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 13750567
bonus_db | 2020-11-14T15:06:06.709023Z 0 [Note] Plugin 'FEDERATED' is disabled.
bonus_db | 2020-11-14T15:06:06.711205Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
bonus_db | 2020-11-14T15:06:06.715836Z 0 [Note] InnoDB: Buffer pool(s) load completed at 201114 15:06:06
bonus_db | 2020-11-14T15:06:06.721862Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
bonus_db | 2020-11-14T15:06:06.721918Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
bonus_db | 2020-11-14T15:06:06.723943Z 0 [Warning] CA certificate ca.pem is self signed.
bonus_db | 2020-11-14T15:06:06.724051Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
bonus_db | 2020-11-14T15:06:06.725417Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
bonus_db | 2020-11-14T15:06:06.725502Z 0 [Note] IPv6 is available.
bonus_db | 2020-11-14T15:06:06.725525Z 0 [Note] - '::' resolves to '::';
bonus_db | 2020-11-14T15:06:06.725562Z 0 [Note] Server socket created on IP: '::'.
bonus_db | 2020-11-14T15:06:06.740164Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
bonus_db | 2020-11-14T15:06:06.765251Z 0 [Note] Event Scheduler: Loaded 0 events
bonus_db | 2020-11-14T15:06:06.765978Z 0 [Note] mysqld: ready for connections.
bonus_db | Version: '5.7.31' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
I tried to log in into container on remote machine like this:
docker exec -i bonus_db mysql -ubonus_user -pbonus_pass
And it seems working, because if I pass wrong password here, it will give the same error Access denied. I've also tried to import data from sql file
docker exec -i bonus_db mysql -ubonus_user -pbonus_pass bonus_db < dump.sql
and it also seems working, it's processing a couple of seconds and then exits to the terminal. But I cant access database from my local machine and from other containers too.

How to access db [Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'172.18.0.3' (using password: YES)] in docker container

I have the following docker-compose.yml file.
I would like to buildthem and connect to DB
version: '3'
services:
api-server:
build: ./api
links:
- 'db'
ports:
- '3000:3000'
volumes:
- ./api:/src
- ./src/node_modules
tty: true
container_name: api-server
db:
build:
context: .
dockerfile: ./db/Dockerfile
restart: always
hostname: db
environment:
MYSQL_ROOT_PASSWORD: test
MYSQL_USER: root
MYSQL_PASSWORD: test
MYSQL_DATABASE: db
volumes:
- './db:/config'
ports:
- 3306:3306
container_name: db
After docker-compose build
then docker-compose up -d
And then `docker exec -it api-server sh'
I could enter containers. and tried
yarn ts-node node_modules/.bin/typeorm migration:show
typeorm command which connect to DB
But it returned
Error during migration show: Error: ER_ACCESS_DENIED_ERROR: Access denied for user 'root'#'172.18.0.3' (using password: YES)
Are there any way to fix it?
Where is the wrong point of it ?
Thanks
Here is docker logs db
docker logs db
2020-09-15 11:57:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-15 11:57:44+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-09-15 11:57:44+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-15 11:57:44+00:00 [Note] [Entrypoint]: Initializing database files
2020-09-15T11:57:44.868762Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-15T11:57:46.939481Z 0 [Warning] InnoDB: New log files created, LSN=45790
2020-09-15T11:57:47.252278Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2020-09-15T11:57:47.327831Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: abfbf3cb-f74a-11ea-bfe8-0242ac120002.
2020-09-15T11:57:47.331570Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-09-15T11:57:48.443477Z 0 [Warning] CA certificate ca.pem is self signed.
2020-09-15T11:57:48.733702Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2020-09-15 11:57:52+00:00 [Note] [Entrypoint]: Database files initialized
2020-09-15 11:57:52+00:00 [Note] [Entrypoint]: Starting temporary server
2020-09-15 11:57:52+00:00 [Note] [Entrypoint]: Waiting for server startup
2020-09-15T11:57:52.490209Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-15T11:57:52.492212Z 0 [Note] mysqld (mysqld 5.7.31) starting as process 77 ...
2020-09-15T11:57:52.497001Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-09-15T11:57:52.497114Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-09-15T11:57:52.497223Z 0 [Note] InnoDB: Uses event mutexes
2020-09-15T11:57:52.497332Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-09-15T11:57:52.497452Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-09-15T11:57:52.497542Z 0 [Note] InnoDB: Using Linux native AIO
2020-09-15T11:57:52.498106Z 0 [Note] InnoDB: Number of pools: 1
2020-09-15T11:57:52.498434Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-09-15T11:57:52.501015Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-09-15T11:57:52.515593Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-09-15T11:57:52.518852Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-09-15T11:57:52.531163Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-09-15T11:57:52.555422Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-09-15T11:57:52.555698Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-09-15T11:57:52.665854Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-09-15T11:57:52.667159Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-09-15T11:57:52.667286Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-09-15T11:57:52.668320Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 2720554
2020-09-15T11:57:52.669761Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-09-15T11:57:52.669911Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-09-15T11:57:52.672485Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200915 11:57:52
2020-09-15T11:57:52.683725Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-09-15T11:57:52.683951Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-09-15T11:57:52.684864Z 0 [Warning] CA certificate ca.pem is self signed.
2020-09-15T11:57:52.684970Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-09-15T11:57:52.687815Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-09-15T11:57:52.704435Z 0 [Note] Event Scheduler: Loaded 0 events
2020-09-15T11:57:52.705512Z 0 [Note] mysqld: ready for connections.
Version: '5.7.31' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL)
2020-09-15 11:57:53+00:00 [Note] [Entrypoint]: Temporary server started.
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
2020-09-15 11:58:00+00:00 [Note] [Entrypoint]: Creating database mogucare_db
2020-09-15 11:58:00+00:00 [Note] [Entrypoint]: Creating user root
ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'#'%'
2020-09-15 11:58:02+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-15 11:58:03+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-09-15 11:58:03+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 5.7.31-1debian10 started.
2020-09-15T11:58:03.406842Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2020-09-15T11:58:03.409690Z 0 [Note] mysqld (mysqld 5.7.31) starting as process 1 ...
2020-09-15T11:58:03.418038Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-09-15T11:58:03.418101Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-09-15T11:58:03.418117Z 0 [Note] InnoDB: Uses event mutexes
2020-09-15T11:58:03.418133Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-09-15T11:58:03.418152Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-09-15T11:58:03.418170Z 0 [Note] InnoDB: Using Linux native AIO
2020-09-15T11:58:03.419647Z 0 [Note] InnoDB: Number of pools: 1
2020-09-15T11:58:03.420784Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-09-15T11:58:03.425652Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-09-15T11:58:03.448462Z 0 [Note] InnoDB: Completed initialization of buffer pool
2020-09-15T11:58:03.457474Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-09-15T11:58:03.473399Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2020-09-15T11:58:03.477057Z 0 [Note] InnoDB: Log scan progressed past the checkpoint lsn 2720554
2020-09-15T11:58:03.737975Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 7963136
2020-09-15T11:58:03.934900Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12578409
2020-09-15T11:58:03.936536Z 0 [Note] InnoDB: Database was not shutdown normally!
2020-09-15T11:58:03.936685Z 0 [Note] InnoDB: Starting crash recovery.
2020-09-15T11:58:04.147681Z 0 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
2020-09-15T11:58:05.179148Z 0 [Note] InnoDB: Apply batch completed
2020-09-15T11:58:05.286743Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2020-09-15T11:58:05.286809Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-09-15T11:58:05.286925Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-09-15T11:58:05.374586Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-09-15T11:58:05.376546Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2020-09-15T11:58:05.377004Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2020-09-15T11:58:05.378022Z 0 [Note] InnoDB: Waiting for purge to start
2020-09-15T11:58:05.439607Z 0 [Note] InnoDB: 5.7.31 started; log sequence number 12578409
2020-09-15T11:58:05.442005Z 0 [Note] Plugin 'FEDERATED' is disabled.
2020-09-15T11:58:05.454028Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-09-15T11:58:05.492756Z 0 [Note] InnoDB: Buffer pool(s) load completed at 200915 11:58:05
2020-09-15T11:58:05.518753Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2020-09-15T11:58:05.518785Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2020-09-15T11:58:05.519497Z 0 [Warning] CA certificate ca.pem is self signed.
2020-09-15T11:58:05.519541Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2020-09-15T11:58:05.536601Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2020-09-15T11:58:05.537666Z 0 [Note] IPv6 is available.
2020-09-15T11:58:05.537947Z 0 [Note] - '::' resolves to '::';
2020-09-15T11:58:05.538239Z 0 [Note] Server socket created on IP: '::'.
2020-09-15T11:58:05.552491Z 0 [Warning] Insecure configuration for --pid-file: Location '/var/run/mysqld' in the path is accessible to all OS users. Consider choosing a different directory.
2020-09-15T11:58:05.574297Z 0 [Note] Event Scheduler: Loaded 0 events
2020-09-15T11:58:05.574997Z 0 [Note] mysqld: ready for connections.
Version: '5.7.31' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
2020-09-15T11:59:47.472547Z 3 [Note] Access denied for user 'root'#'172.18.0.3' (using password: YES)
2020-09-15T12:03:15.760923Z 4 [Note] Access denied for user 'root'#'172.18.0.3' (using password: YES)
The reason is in MySQL database mysql, table users. The user you are connecting with doesn't have permission - either because it doesn't exist, you have the wrong password, or you have no rights to connect from your IP to the target database.
In many cases, MySQL docker containers come configured to only allow connections to localhost (127.0.0.1) which means you must either (a) use port forwarding or (b) grant the user permission to connect from anywhere (i.e. %). Sometimes there is also a configuration switch that will automatically do this for you - read the documentation for your db container.

Access denied for user 'root'#'localhost' with mariadb 10.4.8 docker container using docker compose and issue while attaching external volume

I am new to Docker, I was trying to crate docker container of mariadb for my application but when I start running mariadb container it shows Access denied for user 'root'#'localhost' (using password: YES) dockerfile
Following is the docker compose I am using.
version: '3'
services:
mysql:
image: mariadb
container_name: mariadb
volumes:
- dbvolume:/var/lib/mysql
- ./AppDatabase.sql:/docker-entrypoint-initdb.d/AppDatabase.sql
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_ROOT_USER: root
MYSQL_USER: root
MYSQL_PASSWORD: root123
MYSQL_DATABASE: appdata
ports:
- "3333:3306"
volumes:
dbvolume:
After trying for multiple times by referring few links I was able to connect my application to docker container but it failed to import AppDatabase.sql script at the time of creating docker container.
But now by using same docker compose file I am not able to connect mariadb to my application and I think even it's not importing SQL script to the database (based on logs I have observed).
Following is the docker log generated while running docker compose:
$ docker logs 3fde358ff015
2019-09-24 17:40:37 0 [Note] mysqld (mysqld 10.4.8-MariaDB-1:10.4.8+maria~bionic) starting as process 1 ...
2019-09-24 17:40:37 0 [Note] InnoDB: Using Linux native AIO
2019-09-24 17:40:37 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2019-09-24 17:40:37 0 [Note] InnoDB: Uses event mutexes
2019-09-24 17:40:37 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2019-09-24 17:40:37 0 [Note] InnoDB: Number of pools: 1
2019-09-24 17:40:37 0 [Note] InnoDB: Using SSE2 crc32 instructions
2019-09-24 17:40:37 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2019-09-24 17:40:37 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2019-09-24 17:40:37 0 [Note] InnoDB: Completed initialization of buffer pool
2019-09-24 17:40:37 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2019-09-24 17:40:37 0 [Note] InnoDB: Upgrading redo log: 2*50331648 bytes; LSN=21810033
2019-09-24 17:40:38 0 [Note] InnoDB: Starting to delete and rewrite log files.
2019-09-24 17:40:38 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 50331648 bytes
2019-09-24 17:40:38 0 [Note] InnoDB: Setting log file ./ib_logfile1 size to 50331648 bytes
2019-09-24 17:40:38 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2019-09-24 17:40:38 0 [Note] InnoDB: New log files created, LSN=21810033
2019-09-24 17:40:38 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2019-09-24 17:40:38 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2019-09-24 17:40:38 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2019-09-24 17:40:38 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2019-09-24 17:40:38 0 [Note] InnoDB: Waiting for purge to start
2019-09-24 17:40:38 0 [Note] InnoDB: 10.4.8 started; log sequence number 21810033; transaction id 14620
2019-09-24 17:40:38 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2019-09-24 17:40:38 0 [Note] Plugin 'FEEDBACK' is disabled.
2019-09-24 17:40:38 0 [Note] Server socket created on IP: '::'.
2019-09-24 17:40:38 0 [Warning] 'proxies_priv' entry '#% root#c980daa43351' ignored in --skip-name-resolve mode.
2019-09-24 17:40:38 0 [Note] InnoDB: Buffer pool(s) load completed at 190924 17:40:38
2019-09-24 17:40:38 0 [Note] Reading of all Master_info entries succeeded
2019-09-24 17:40:38 0 [Note] Added new Master_info '' to hash table
2019-09-24 17:40:38 0 [Note] mysqld: ready for connections.
Version: '10.4.8-MariaDB-1:10.4.8+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution
SQL Script I am trying to import:
create database appdata;
use appdata;
CREATE TABLE `appdatadetails` (
`Name` varchar(8) NOT NULL,
`appIndex` int(11) NOT NULL,
`connector` varchar(16) DEFAULT NULL,
`intName` varchar(12) DEFAULT NULL,
`intIndex` int(11) DEFAULT NULL,
PRIMARY KEY (`Name`,`appIndex`)
)
Please help me to understand what I am doing wrong, I have tried all possible solution posted on different blogs.
Update:
Latest Update:
I was able to up and running mariadb docker image with 10.1. But if I attach volume then still I am facing issue.
Docker Compose:
version: '3'
services:
mysql:
image: mariadb:10.1
container_name: mariadb
volumes:
- container-volume:/var/lib/mysql
- ./AppDatabase.sql:/docker-entrypoint-initdb.d/AppDatabase.sql
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: appdata
ports:
- "3333:3306"
volumes:
container-volume:
And the log error message, If I attach container-volume volume.
Creating mariadb ... done
Attaching to mariadb
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] mysqld (mysqld 10.1.41-MariaDB-1~bionic) starting as process 1 ...
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Using mutexes to ref count buffer pool pages
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: The InnoDB memory heap is disabled
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Compressed tables use zlib 1.2.11
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Using Linux native AIO
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Using SSE crc32 instructions
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Initializing buffer pool, size = 256.0M
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Completed initialization of buffer pool
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] InnoDB: Highest supported file format is Barracuda.
mariadb | InnoDB: No valid checkpoint found.
mariadb | InnoDB: A downgrade from MariaDB 10.2.2 or later is not supported.
mariadb | InnoDB: If this error appears when you are creating an InnoDB database,
mariadb | InnoDB: the problem may be that during an earlier attempt you managed
mariadb | InnoDB: to create the InnoDB data files, but log file creation failed.
mariadb | InnoDB: If that is the case, please refer to
mariadb | InnoDB: http://dev.mysql.com/doc/refman/5.6/en/error-creating-innodb.html
mariadb | 2019-09-25 6:56:26 140542855440384 [ERROR] Plugin 'InnoDB' init function returned error.
mariadb | 2019-09-25 6:56:26 140542855440384 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
mariadb | 2019-09-25 6:56:26 140542855440384 [Note] Plugin 'FEEDBACK' is disabled.
mariadb | 2019-09-25 6:56:26 140542855440384 [ERROR] Unknown/unsupported storage engine: InnoDB
mariadb | 2019-09-25 6:56:26 140542855440384 [ERROR] Aborting
mariadb |
mariadb exited with code 1
If I remove container-volume then It is importing .sql script and running well and good.
Updated with working script: Before I was using mariadb 10.4.8 or latest and facing issue(s) to access DB and attaching external volume.
Now I have downgraded (As suggested by #Adiii) and tried. It runs perfectlly and we no need to specify external: true in volumes service
version: '3'
services:
mysql:
image: mariadb:10.1
container_name: mariadb
volumes:
- ./dbvolume:/var/lib/mysql
- ./AppDatabase.sql:/docker-entrypoint-initdb.d/AppDatabase.sql
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: appdata
ports:
- "3333:3306"
It will affect the new user and keys even if you create fresh container.
Remove mount location, as it will pick a user name and password from this location, also will not run your DB init script too.
volumes:
- dbvolume:/var/lib/mysql
Also you do not need
create database appdata;
As database already created at
MYSQL_ROOT_PASSWORD: root123
MYSQL_ROOT_USER: root
MYSQL_DATABASE: appdata
this step.
update:
remove the user root, as root already defined. you can try with
version: '3.7'
services:
mysql:
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: appdata
image: mariadb
Or the second user should be different
version: '3.7'
services:
mysql:
environment:
MYSQL_ROOT_PASSWORD: root123
MYSQL_DATABASE: appdata
MYSQL_USER: test
MYSQL_PASSWORD: root123
image: mariadb
you can try with
docker exec -it container_name bash -c "mysql -u test -proot123"
or
docker exec -it mysql bash -c "mysql -u root -proot123"
If still issue, remove the DB image, pull a new one.
Or try image tag 10.1
If I remove container-volume then It is importing .sql script and
running well and good.
if mount the location then the init script will not run as the container is expecting that there is already DB or try to remove named volume and create new one.
So mount the location, import the DB using MySQL command and use the mount location for next time.

Docker: Mysql crashes after few seconds when it has been started

I am on Mac 10.11.3 (15D21)
About Docker I have:
$ docker version
Client:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: darwin/amd64
Server:
Version: 1.10.3
API version: 1.22
Go version: go1.5.3
Git commit: 20f81dd
Built: Thu Mar 10 21:49:11 2016
OS/Arch: linux/amd64
With the following Dockerfile (it to resolve Docker with mysql: The error means mysqld does not have the access rights to the directory):
FROM mysql:latest
RUN deluser mysql
RUN useradd mysql
RUN mkdir -p /Users/me/docker/mysql/data
RUN chmod -R 777 /Users/me/docker/mysql/data
I have created a new image docker build -t localmysql:latest . named localmysql
REPOSITORY TAG IMAGE ID CREATED SIZE
localmysql latest ea0f7da32de8 15 hours ago 361.6 MB
I can create the manolitomysql new container from the localmysql new image (I am using multiple lines for better appreciation):
docker run -v /Users/me/docker/mysql/data:/var/lib/mysql
--name manolitomysql
-e MYSQL_DATABASE='mysqldb' -e MYSQL_USER='mysql'
-e MYSQL_PASSWORD='mysql' -e MYSQL_ALLOW_EMPTY_PASSWORD='yes'
-e MYSQL_ROOT_PASSWORD='' -d localmysql
The container runs:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
06f15352aa7c localmysql "/entrypoint.sh mysql" 23 seconds ago Up 22 seconds 3306/tcp manolitomysql
Even I can enter to the console with docker exec -it manolitomysql /bin/bash
But after of more of 30 seconds the container crushes
#docker logs manolitomysql
Initializing database
2016-03-28T13:27:01.600230Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2016-03-28T13:27:03.355428Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-03-28T13:27:03.705206Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-03-28T13:27:03.765510Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: c2837bb5-f4e8-11e5-a856-0242ac110002.
2016-03-28T13:27:03.766641Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-03-28T13:27:03.767732Z 1 [Warning] root#localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
2016-03-28T13:27:04.960541Z 1 [Warning] 'user' entry 'root#localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960616Z 1 [Warning] 'user' entry 'mysql.sys#localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960716Z 1 [Warning] 'db' entry 'sys mysql.sys#localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960846Z 1 [Warning] 'proxies_priv' entry '# root#localhost' ignored in --skip-name-resolve mode.
2016-03-28T13:27:04.960962Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys#localhost' ignored in --skip-name-resolve mode.
Database initialized
MySQL init process in progress...
2016-03-28T13:27:07.059842Z 0 [Note] mysqld (mysqld 5.7.11) starting as process 38 ...
2016-03-28T13:27:07.062158Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
2016-03-28T13:27:07.063330Z 0 [ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
2016-03-28T13:27:07.063747Z 0 [Note] InnoDB: PUNCH HOLE support available
2016-03-28T13:27:07.063766Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2016-03-28T13:27:07.063776Z 0 [Note] InnoDB: Uses event mutexes
2016-03-28T13:27:07.063785Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2016-03-28T13:27:07.063794Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.8
2016-03-28T13:27:07.063803Z 0 [Note] InnoDB: Using Linux native AIO
2016-03-28T13:27:07.063957Z 0 [Note] InnoDB: Number of pools: 1
2016-03-28T13:27:07.064037Z 0 [Note] InnoDB: Using CPU crc32 instructions
2016-03-28T13:27:07.069596Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2016-03-28T13:27:07.075441Z 0 [Note] InnoDB: Completed initialization of buffer pool
2016-03-28T13:27:07.076643Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2016-03-28T13:27:07.102198Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
2016-03-28T13:27:07.133326Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2016-03-28T13:27:07.133809Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2016-03-28T13:27:07.185431Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2016-03-28T13:27:07.263862Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
2016-03-28T13:27:07.263953Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
2016-03-28T13:27:07.264530Z 0 [Note] InnoDB: Waiting for purge to start
2016-03-28T13:27:07.315152Z 0 [Note] InnoDB: 5.7.11 started; log sequence number 2492554
2016-03-28T13:27:07.315489Z 0 [Note] Plugin 'FEDERATED' is disabled.
2016-03-28T13:27:07.316620Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2016-03-28T13:27:07.326420Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-03-28T13:27:07.326507Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2016-03-28T13:27:07.326522Z 0 [ERROR] Unable to setup unix socket lock file.
2016-03-28T13:27:07.326531Z 0 [ERROR] Aborting
2016-03-28T13:27:07.326545Z 0 [Note] Binlog end
2016-03-28T13:27:07.326591Z 0 [Note] Shutting down plugin 'ngram'
2016-03-28T13:27:07.326605Z 0 [Note] Shutting down plugin 'BLACKHOLE'
2016-03-28T13:27:07.326614Z 0 [Note] Shutting down plugin 'partition'
2016-03-28T13:27:07.326623Z 0 [Note] Shutting down plugin 'ARCHIVE'
2016-03-28T13:27:07.326632Z 0 [Note] Shutting down plugin 'MEMORY'
2016-03-28T13:27:07.326641Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL'
2016-03-28T13:27:07.326650Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES'
2016-03-28T13:27:07.326658Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES'
2016-03-28T13:27:07.326673Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS'
2016-03-28T13:27:07.326681Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN'
2016-03-28T13:27:07.326690Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS'
2016-03-28T13:27:07.326698Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS'
2016-03-28T13:27:07.326706Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES'
2016-03-28T13:27:07.326715Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS'
2016-03-28T13:27:07.326723Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES'
2016-03-28T13:27:07.326731Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE'
2016-03-28T13:27:07.326740Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE'
2016-03-28T13:27:07.326748Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG'
2016-03-28T13:27:07.326757Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2016-03-28T13:27:07.326765Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2016-03-28T13:27:07.326773Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2016-03-28T13:27:07.326782Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2016-03-28T13:27:07.326790Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2016-03-28T13:27:07.326798Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2016-03-28T13:27:07.326807Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2016-03-28T13:27:07.326816Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2016-03-28T13:27:07.326824Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2016-03-28T13:27:07.326832Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2016-03-28T13:27:07.326841Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2016-03-28T13:27:07.326850Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2016-03-28T13:27:07.326858Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2016-03-28T13:27:07.326866Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2016-03-28T13:27:07.326875Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2016-03-28T13:27:07.326883Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2016-03-28T13:27:07.326894Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2016-03-28T13:27:07.326903Z 0 [Note] Shutting down plugin 'InnoDB'
2016-03-28T13:27:07.326970Z 0 [Note] InnoDB: FTS optimize thread exiting.
2016-03-28T13:27:07.327081Z 0 [Note] InnoDB: Starting shutdown...
2016-03-28T13:27:07.327112Z 0 [Note] InnoDB: Buffer pool(s) load completed at 160328 13:27:07
2016-03-28T13:27:07.327946Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2016-03-28T13:27:07.328953Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 160328 13:27:07
MySQL init process in progress...
MySQL init process in progress...
2016-03-28T13:27:08.954395Z 0 [Note] InnoDB: Shutdown completed; log sequence number 2492573
2016-03-28T13:27:08.956113Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2016-03-28T13:27:08.956170Z 0 [Note] Shutting down plugin 'MyISAM'
2016-03-28T13:27:08.956206Z 0 [Note] Shutting down plugin 'MRG_MYISAM'
2016-03-28T13:27:08.956221Z 0 [Note] Shutting down plugin 'CSV'
2016-03-28T13:27:08.956234Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA'
2016-03-28T13:27:08.956293Z 0 [Note] Shutting down plugin 'sha256_password'
2016-03-28T13:27:08.956306Z 0 [Note] Shutting down plugin 'mysql_native_password'
2016-03-28T13:27:08.956317Z 0 [Note] Shutting down plugin 'keyring_file'
2016-03-28T13:27:08.956515Z 0 [Note] Shutting down plugin 'binlog'
2016-03-28T13:27:08.956853Z 0 [Note] mysqld: Shutdown complete
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process in progress...
MySQL init process failed.
Manuels-MacBook-Pro:~ manueljordan$
Below the errors from above:
One
[ERROR] Plugin keyring_file reported: 'keyring_file initialization failure. Please check if the keyring_file_data points to readable keyring file or keyring file can be created in the specified location. The keyring_file will stay unusable until correct path to the keyring file gets provided'
Second
[ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
[ERROR] Unable to setup unix socket lock file.
[ERROR] Aborting
What extra configuration is needed?
I'm guessing that you've got permissions issues, and that /var/run/mysqld is owned by the UID/GID of the mysql user created by the MySQL install process in the original Docker image. Try this in your Dockerfile:
FROM mysql:latest
RUN deluser mysql
RUN useradd mysql
RUN chown mysql:mysql /var/run/mysqld
RUN mkdir -p /Users/me/docker/mysql/data
RUN chmod -R 777 /Users/me/docker/mysql/data
Further guessing that the case is the same for the 'keyring_file', wherever that's located. Try running a docker run -it manolitomysql /bin/bash to get a shell prompt into your container, and see if you can draw a bead on it.
2016-03-28T13:27:07.326420Z 0 [Warning] Failed to set up SSL because of the following SSL library error: SSL context is not usable without certificate and private key
2016-03-28T13:27:07.326507Z 0 [ERROR] Could not create unix socket lock file /var/run/mysqld/mysqld.sock.lock.
2016-03-28T13:27:07.326522Z 0 [ERROR] Unable to setup unix socket lock file.
maybe you need to configure SSL certificates?