docker-library / mysql

Docker Official Image packaging for MySQL Community Server
https://dev.mysql.com/
GNU General Public License v2.0
2.47k stars 2.2k forks source link

Host '172.18.0.1' is not allowed to connect to this MySQL server #275

Closed sougiovn closed 6 years ago

sougiovn commented 7 years ago

I'm trying to connect to the MySQL by the DBeaver db manager.

But I get this error: java.sql.SQLException: null, message from server: "Host '172.18.0.1' is not allowed to connect to this MySQL server"

I using docker-compose, here is my docker-compose.yml:

version: '2'
services:
  db:
    image: 'mysql:5.7'
    volumes:
       - '~/dev/dbs-data/mysql:/var/lib/mysql'
    restart: 'always'
    expose:
      - '3306'
    ports:
      - '3306:3306'
    environment:
       MYSQL_ROOT_PASSWORD: 'pass'
       MYSQL_DATABASE: 'db'
       MYSQL_USER: 'user'
       MYSQL_PASSWORD: 'pass'

The problem is that, in my Mac it works, but in my Linux I get the error above.

Should I do some other configuration for my linux?

ghost commented 7 years ago

Same here. The problem suddenly appears today on a new container 5.7.17. all previous containers with the same image are fine (sounds impossible, I know).

Still investigating how it changed from working to not working from one day to the next.

sougiovn commented 7 years ago

I resolved removing the volumes configuration.

ltangvald commented 7 years ago

Can you check the user,host columns in your mysql.user table to make sure the user isn't limited in some way. And also run from the container (or with exec) mysqld --verbose --help | grep bind-address To check that the server will allow external connections

ghost commented 7 years ago

Thanks for the tipp @ltangvald the user was completely missing and so was the database. The problem was in my docker-compose calls that launched two containers simultanously which shared a data volume.

s1dekick223 commented 7 years ago

Hey @ltangvald, i've the same problem but dont really understand how to do this can you help me and telling me where i find my mysql stuff?

lucile-sticky commented 7 years ago

@s1dekick223

Check if the database user exists and can connect

In MySQL, each database user is defined with IP address in it, so you can have for example a root user allowed to connect from localhost (127.0.0.1) but not from other IP addresses. With a container, you never access to the database from 127.0.0.1, it could explain the problem.

To check it, you can do the following:

1* From a terminal, connect you to your MySQL running container

docker exec -it your_container_name_or_id bash

2* In your container, connect you to the MySQL database

mysql -u your_user -p

It will ask you your password, you have to write it and press enter.

3* In your MySQL database, execute this SQL script to list all existing database users

SELECT host, user FROM mysql.user;

It will display a table, for example like this:

+------------+------------------+
| host       | user             |
+------------+------------------+
| %          | root             |
| 127.0.0.1  | root             |
| ::1        | root             |
| localhost  | mysql.sys        |
| localhost  | root             |
| localhost  | sonar            |
+------------+------------------+

It has to contain a line with your database user and '%' to works (% means "every IP addresses are allowed"). Example:

+------------+------------------+
| host       | user             |
+------------+------------------+
| %          | root             |
+------------+------------------+

My root user can connect itself from any IP addresses.

Are external connections allowed?

After that, like @ltangvald said, it could be a problem of allowing external connections to the container.

To check it, you can do the following:

1* From a terminal, connect you to your MySQL running container

docker exec -it your_container_name_or_id bash

2* In your container, run this command

mysqld --verbose --help | grep bind-address

It will display address to bind to, for example like this:

  --bind-address=name IP address to bind to.
bind-address                                                 0.0.0.0

The bind address have to be 0.0.0.0 (which means "every IP addresses") to work.

Also, a note:

Using docker-compose, if you link a volume, the parameters

    environment:
       MYSQL_ROOT_PASSWORD: 'pass'
       MYSQL_DATABASE: 'db'
       MYSQL_USER: 'user'
       MYSQL_PASSWORD: 'pass'

in your docker-compose.yml will not be used, so default user will not be created: you have to create it manually or remove the volume declaration.

yosifkit commented 7 years ago

Using docker-compose, if you link a volume, the parameters

   environment:
      MYSQL_ROOT_PASSWORD: 'pass'
      MYSQL_DATABASE: 'db'
      MYSQL_USER: 'user'
      MYSQL_PASSWORD: 'pass'

in your docker-compose.yml will not be used, so default user will not be created: you have to create it manually or remove the volume declaration.

This is not quite accurate. They will be used if the database files do not exist in the folder. If it is a folder from a previous run of mysql, either from another container or an install from the host machine (ensure neither is running), then the initialization step will be skipped and these environment variables have no effect.

If there is no important data in the files, you can always docker-compose rm -fv; sudo rm -rf ~/dev/dbs-data/mysql/* and then docker-compose up -d.

thedrint commented 7 years ago

I have today this problem, but it was my mistake.

I copying docker-compose.yml and related volumes directories (where logs and database settings stored) from one old project to another new project. And run docker-compose up -d

So i have, in result, mysql's service image builted from cache, with database settings from original project. No environments were applied, @yosifkit make exact definition of situation.

Simply delete from volume's directory all old mysql data, rebuild image - and all works fine.

LordRahl90 commented 7 years ago

please @lucile-sticky my bind-address is '*' how do i edit it to '0.0.0.0'??? Thanks

lucile-sticky commented 7 years ago

@LordRahl90 to change the bind-address option, you have to:

Example: In my case, I create my own mysqld.cnf file:

[mysqld]
pid-file                = /var/run/mysqld/mysqld.pid
socket                  = /var/run/mysqld/mysqld.sock
# Where the database files are stored inside the container
datadir                 = /var/lib/mysql

# My application special configuration
max_allowed_packet          = 32M
sql-mode                    = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION'

# Accept connections from any IP address
bind-address                = 0.0.0.0

Then in my Dockerfile, I tell to Docker to copy it inside the container:

FROM mysql:5.6
MAINTAINER lucile-sticky "aaa@bbb.ccc"

# Setup the custom configuration
ADD mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf

So when MySQL starts, it uses my special configuration instead of the default one.

littlee commented 7 years ago

@lucile-sticky I'm having the same issue as which @LordRahl90 has, but I want to ask, why mysql does not set bind-address to 0.0.0.0 when it start? Do I have to set it manually?

lucile-sticky commented 7 years ago

@littlee I don't know what is the default value of bind-address for MySQL, that's why I specify it, to be sure to have the wanted one.

geerlingguy commented 7 years ago

For me, I hit the same issue once I switched the volume to a path local on my computer, then went through a docker-compose down and docker-compose up -d cycle. After clearing out the files in that directory, the next docker-compose up -d created things fresh, and it worked fine.

I didn't have this problem when using a data volume (volumes: ['db_data:/var/lib/mysql']).

Danisan commented 7 years ago

You can also copy the my.cnf file docker cp mysql_mysql_1:/etc/my.cnf conf/

And then include a volume mapping exclusively to your file.

volumes:
    - './conf/my.cnf:/etc/my.cnf'

So you can add bind-address=0.0.0.0 to your my.cnf file.

Anyway, I've done this, but still cannot connect from outside.

lucasdidur commented 7 years ago

I fixed executing this command on docker container:

# mysql_secure_installation

ufukomer commented 7 years ago

@Danisan me too. Did you find the solution?

T101N commented 7 years ago

I think I know the issue. When using docker-compose, a new network is created with a different subnet, leading to a new gateway and ip address. By default, mysql will use 172.17.0.1 as a gateway for communication - which is normally the value on the 'bridge' network (you can view this using docker inspect bridge and docker inspect <your instance name or ID>). To view available networks, you can use docker network ls.

A new root host needs to be specified to allow specified IPs to connect if you're going to use docker-compose the way you have it, but you will also need to know what your new subnet will be. In docker-compose version 3, you lose the ability to specify your own gateway for a new network - I'm guessing the gateway will always be x.x.x.1. However, you do have the ability to specify the subnet for the new network (this video does a good enough job to helping you understand subnetting assuming you already know a bit of binary math).

Documentation doesn't seem to be updated or at least I was unable to use "bridge", so what I did was create a new network. [edit] After reading the error, it seems like you can only re-use user defined networks.

Here's my docker-compose.yml file

version: '3'

services:
  mysql:
    image: mysql/mysql-server:5.7

    env_file: #Use environment variables from file.
      - mysql.env

    volumes:
      - ./data:/var/lib/mysql

    ports:
      - 3306:3306

    environment:
      ## Use % to allow remote access to all addresses. 
      ## Generally not recommended by some people to allow for root.
      #- MYSQL_ROOT_HOST=% 

      # This allows ip ranges from 192.168.0.49 to 192.168.0.54 to connect to root
      - MYSQL_ROOT_HOST=192.168.0.48/255.255.255.248

    networks:
      network:
        ipv4_address: 172.20.0.2

networks:
  network: #will be prefixed with 'parent_dir_name_' so for me, it will be 'mysql_network'
    ipam:
      config:
        - subnet: 172.20.0.0/16

Currently looking into other ways and learning more about networking and docker.

Using the compose file above, to connect to the database, you'll need to use the IP of the machine that the container is being hosted on, rather than the IP of the container; so localhost won't work unless a user with host 172.20.0.1 is created - and localhost won't work on a different machine because 127.0.0.1 is loopback. For example, if the machine that's running the mysql container is using 192.168.1.25 on my network, that will be the IP entered to access my database.

meenakshik-optimus commented 7 years ago

@lucile-sticky I am having this in my mysql.user table. | host | user | +-----------+---------------+ | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+---------------+ and I am getting the same error ""Host '172.22.0.1' is not allowed to connect to this mysql server". Suggest some way to resolve the issue.

Dmthakkar commented 7 years ago

Hi @meenakshik-optimus,

Create new user with host '%' rather than localhost. Below is works for me. It may useful to you. mysql> CREATE USER 'usernameall'@'%' IDENTIFIED BY 'ThePassword'; mysql> grant all on *.* to 'usernameall'@'%';

ureesoriano commented 7 years ago

I am experiencing the same issue with 5.7.19

Did a quick test: I ran 2 containers; the first with 5.6.34 and the second with 5.7.19 & listed the users on the mysql.user table on both of them (jfr: ran the first, stopped it and then ran the second). While on 5.6.34 there is an entry for 'root' on '%', it is not the case with 5.6.34. It looks like the "culprit" might be either mysql 5.7 (as a new default for user root maybe?) or the bootstraping process on the docker image mysql:5.7

5.6.34 mysql.user table:

> select Host, User from user \G
*************************** 1. row ***************************
                  Host: %
                  User: root

5.7.19 mysql.user table:

*************************** 1. row ***************************
                  Host: localhost
                  User: root
*************************** 2. row ***************************
                  Host: 127.0.0.1
                  User: root

Here is the docker-compose definition I used for the 5.6.34 service:

 api-db:
     image: mysql:5.6.34
     volumes:
       - ./devel-api-db:/var/lib/mysql:rw
     environment:
       - MYSQL_ROOT_PASSWORD=root
       - MYSQL_DATABASE=app1
       - MYSQL_USER=super-secret-pwd
       - MYSQL_PASSWORD=devel
       - MYSQL_ROOT_HOST=127.0.0.1
     ports:
       - "3307:3306"

Here is the docker-compose definition for the 5.7.19 service:

 api-db:
     image: mysql:5.7.19
     volumes:
       - ./devel-api-db:/var/lib/mysql:rw
     environment:
       - MYSQL_ROOT_PASSWORD=root
       - MYSQL_DATABASE=app1
       - MYSQL_USER=super-secret-pwd
       - MYSQL_PASSWORD=devel
       - MYSQL_ROOT_HOST=127.0.0.1
     ports:
       - "3307:3306"
meenakshik-optimus commented 7 years ago

@ Dmthakkar.. I want it all to be done using docker file, so that I just need to run an instance of the image and everything will be set. How can I achieve this using docker file? Any suggestion?

markfickett commented 7 years ago

I ran into this symptom for a different reason. For posterity:

My project is set up to run containers with docker-compose and our custom services have user: ${UID}. At some point while debugging, I ran the db service (which just uses the mysql:5.7 image) as root -- without running export UID in my shell beforehand. That caused its volume to have the wrong permissions. So the fix for me was to remove all volumes (docker volume rm $(docker volume ls -q)) and then either (a) run my default project scripts, which take care of publishing UID, or (b) export UID in my shell and then run one-offs like docker-compose run db or docker-compose run db-migration.

My `docker-compose.yaml' contained:

services:
  db:
    image: mysql:5.7
    env_file:
      - db/vars.env
    volumes:
      - db:/var/lib/mysql
  db-migration:
    depends_on:
      - db
    user: ${UID}
    build:
      ...

In my case, bind-address was * instead of 0.0.0.0, and that was fine; and I didn't see any difference between mysql:5.7 (which uses 5.7.20 currently) and the previous 5.7.19. And none of the issues seemed to be with images/containers, just with the volumes' permissions; I can deterministically recreate the issue by changing whether I export UID and deleting/recreating volumes, without changing images. The volume permission issue led to db setup failing (so the root user wasn't configured correctly even though mysqld started).

tianon commented 6 years ago

I think this is probably as solved as it's going to be (and is turning into a dumping ground for other folks' connection issues). I'm going to close since there's nothing to be changed in the image (as far as I can tell -- would love to see a PR if that's not correct :heart:).

In the future, these sorts of questions/requests would be more appropriately posted to the Docker Community Forums, the Docker Community Slack, or Stack Overflow. Thanks! :+1:

Synaxis commented 6 years ago

You need .env file

DATABASE_NAME=DBNAME DATABASE_HOST=127.0.0.1 DATABASE_PASSWORD=DBPASS DATABASE_USERNAME=ROOTNAME

NextZeus commented 6 years ago

my solution with mysql 5.7.x

docker run -p 3306:3306 --name mysql2 -e MYSQL_ROOT_PASSWORD=b3RmELKOvCUrAdxIg0GEmugc3SY -e MYSQL_ROOT_HOST=% -d mysql/mysql-server:latest

MySQLWorkbench config

Hostname: 0.0.0.0
Port: 3306
Username: root
Password: b3RmELKOvCUrAdxIg0GEmugc3SY  [mysql  random secret]

nodejs mysql


var mysql      = require('mysql');
var connection = mysql.createConnection({
  host     : '0.0.0.0',
  port     : 3306,
  user     : 'root',
  password : 'b3RmELKOvCUrAdxIg0GEmugc3SY',
  database : 'mysql'
});

connection.connect();

connection.query('SELECT 1 + 1 AS solution', function (error, results, fields) {
  if (error) throw error;
  console.log('The solution is: ', results[0].solution);
});

connection.end();
isometriq commented 6 years ago

Stupid issue for me ...it was not working because I've explicitly set  MYSQL_RANDOM_ROOT_PASSWORD=no

Complely removing the key/value now works (it uses the MYSQL_ROOT_PASSWORD value)

danaia commented 6 years ago

Any ideas why this would be happening?: I have an install script which installs both Laradock and my Larvel application. I use this install script successfully within a Virtualbox VM - Ubuntu 16.04 without any issues at all. Every thing comes up and MySQL migrates no problem. I then install the exact same Ubuntu 16.04 OS on my same machine. This time, not as a VM but as the native OS. I run the exact same script, under the same Ubuntu OS with no modifications at all and I get the dreaded MySQL: "SQLSTATE[HY000] [1130] Host '172.20.0.3' is not allowed to connect to this MySQL server" during migration. Why would 2 identical systems react this way? Everything is exactly the same and I have repeated this problem 3 times so far.

skytreader commented 6 years ago

I've encountered this same problem as originally described (though with a Python web app): I've used mysql:5.7 before and, in a new project, I suddenly could not connect to my mysql container, managed with docker-compose.

TL;DR of how I solved it:

Details:

I am debugging a problem with docker-compose in an existing project and decided to create a short self-contained example that will reliably reproduce the problem I am having. I started with the base framework files, copied the Dockerfile and docker-compose.yml and edited the project-specific values. My docker-compose.yml looked like:

version: '2'
services:
  db_test:
    image: "mysql:5.7"
    environment:
      - MYSQL_ALLOW_EMPTY_PASSWORD=yes
      - MYSQL_DATABASE=app_test
    ports:
      - "3309:3306"
  test:
    build: .
    volumes:
      - .:/main
    depends_on:
      - db_test

In the course of debugging my original problem, I ended up adding the MYSQL_ROOT_PASSWORD env var alongside those already present. That's when I started encountering the problem described in this issue.

Thanks to lucile's excellent rundown above, I determined that the container created does not have the entry (%, root) in mysql.user. Note that this entry is present in the container created for my other (original) project.

I ended up cleaning my test project and, by chance, fell into the sequence of steps as described above and solved my problem.

luozhouyang commented 6 years ago

If I set a volume arg, the container raise some errors like cannot connect to x.x.x.x。 And I found that mysqld start faild. It's seems that mysqld can't create tmp files in /tmp dir. I tried a lot of ways to solve this problem. Here is a solution for my problem:

# in container
chmod -R 777 /tmp
service mysql restart

mysqld started successfully, and everything goes well. I do not know why, but it just works. You can have a try.

Montego commented 6 years ago

i have some problems. My docker-compose.yml: version: '2'
services:
nginx:
image: nginx:latest ports:

and when i'm trying login adminer with a such parameters:

System MySQL Server mysql Username root Password root

i have this error :"Host '172.18.0.3' is not allowed to connect to this MySQL server" Can someone help me please?or any ideas about the problems?

s1dekick223 commented 6 years ago

@Montego rm the old containers from this build and try to run start it with docker-compose up -d

Montego commented 6 years ago

@s1dekick223 sorry for maybe stupid question, but how can i rm the old containers from this build correctly?

s1dekick223 commented 6 years ago

@Montego There are two ways, you can use Kitematic for that or you're using the terminal. For the terminal use docker ps -a to search for your container(s) then use docker rm *containerID* to rm it

Montego commented 6 years ago

@s1dekick223 thanks a lot. But...if i use docker-compose down before - i haven't containers if docker-compose is running, i have 3 containers: dockermaster_nginx_1, dockermaster_php_1, dockermaster_mysql_1 and i can't to rm this, because "Error response from daemon: You cannot remove a running container 49fcc2eda685202c4deb0bf27829221ff61ee4a13753ff543a5410591c2f9f46. Stop the container before attempting removal or force remove"

s1dekick223 commented 6 years ago

@Montego go into the root where your docker-compose.yml is start terminal and use docker-compose stop to shut them down

Montego commented 6 years ago

@s1dekick223 montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker-compose stop Stopping dockermaster_nginx_1 ... done Stopping dockermaster_php_1 ... done Stopping dockermaster_mysql_1 ... done montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker ps -a CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 7344beca70a6 nginx:latest "nginx -g 'daemon ..." 15 minutes ago Exited (0) 11 seconds ago dockermaster_nginx_1 eaa46ef7a7d8 dockermaster_php "docker-php-entryp..." 15 minutes ago Exited (0) 10 seconds ago dockermaster_php_1 83cdaaa4c195 mysql:latest "docker-entrypoint..." 15 minutes ago Exited (0) 7 seconds ago dockermaster_mysql_1 montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker rm 7344beca70a6 7344beca70a6 montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker rm eaa46ef7a7d8 eaa46ef7a7d8 montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker rm 83cdaaa4c195 83cdaaa4c195 montego@montego-Inspiron-5767:~/Work/Projects/docker-master$ docker-compose up -d Creating dockermaster_mysql_1 Creating dockermaster_php_1 Creating dockermaster_nginx_1 `

unfortunately, i still have my error "Host '172.18.0.3' is not allowed to connect to this MySQL server " in adminer :(

s1dekick223 commented 6 years ago

@Montego how long do you let him build? the sql image is having a weird brake you've to wait about 1-3 minutes while he's building the sql container ... try to run it and get yourself a drink or something like this ^^

Montego commented 6 years ago

@s1dekick223 about 5-10 seconds :) I can't resolve this problem about 3 days and this is killing me slowly >_<

mwaeckerlin commented 6 years ago

Again: What is the problem? Somehow all answers look weird to me. Something really bad must have been changed in the project?

I can no more start a mysql server and successfully connect a wordpress to it. It used to work some weeks ago, and it still works with old deployments, so it seems that initializing a new empty mysql from scratch is broken.

I'm, using docker swarm.

mwaeckerlin commented 6 years ago

What I see:

This works no more:

version: '3.3'
services:

  mysql:
    image: mysql
    volumes:
      - type: bind
        source: /srv/volumes/test/mysql
        target: /var/lib/mysql
    environment:
      - 'MYSQL_DATABASE=wordpress'
      - 'MYSQL_USER=wordpress'
      - 'MYSQL_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei'
      - 'MYSQL_ROOT_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he'
    command: --log-bin=/var/lib/mysql/mysql-bin.log --binlog-format=ROW --server-id=1

  wordpress:
    image: wordpress
    ports:
      - 8080:80
    volumes:
      - type: bind
        source: /srv/volumes/test/wordpress
        target: /var/www/html
      - type: bind
        source: /srv/volumes/config/volumes/uploads.ini
        target: /usr/local/etc/php/conf.d/uploads.ini
    environment:
      - 'WORDPRESS_DB_HOST=mysql'
      - 'WORDPRESS_DB_NAME=wordpress'
      - 'WORDPRESS_DB_USER=wordpress'
      - 'WORDPRESS_DB_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei'

But with the following changes in the environment, it works:

version: '3.3'
services:

  mysql:
    image: mysql
    volumes:
      - type: bind
        source: /srv/volumes/test/mysql
        target: /var/lib/mysql
    environment:
      #- 'MYSQL_DATABASE=wordpress'
      #- 'MYSQL_USER=wordpress'
      #- 'MYSQL_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei'
      - 'MYSQL_ROOT_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he'
      - 'MYSQL_ROOT_HOST=%'
    command: --log-bin=/var/lib/mysql/mysql-bin.log --binlog-format=ROW --server-id=1

  wordpress:
    image: wordpress
    ports:
      - 8080:80
    volumes:
      - type: bind
        source: /srv/volumes/test/wordpress
        target: /var/www/html
      - type: bind
        source: /srv/volumes/config/volumes/uploads.ini
        target: /usr/local/etc/php/conf.d/uploads.ini
    environment:
      #- 'WORDPRESS_DB_HOST=mysql'
      #- 'WORDPRESS_DB_NAME=wordpress'
      #- 'WORDPRESS_DB_USER=wordpress'
      #- 'WORDPRESS_DB_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei'
      - 'WORDPRESS_DB_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he'

Why?

yosifkit commented 6 years ago

@Montego Do you have an already initializated database in ./mysql? The environment variables are only use on first initialization. See also https://github.com/docker-library/postgres/issues/203#issuecomment-255200501.

@mwaeckerlin, probably related to the move from 5.7 to 8: https://github.com/docker-library/mysql/issues/409

tarikhagustia commented 6 years ago

adding

environment:
      - MYSQL_ROOT_HOST=%

fix my problem

mwaeckerlin commented 6 years ago

@tarikhagustia @yosifkit , I'd expect that configuration options remain the same even if the MySQL version changes, unless there is no very good reason for changing them.

Especially initializing a user and database, which seems not to work anymore, is a very useful and needed feature!

If required, MYSQL_ROOT_HOST=% should be the default if MYSQL_ROOT_HOST is not explicitely set.

yosifkit commented 6 years ago

@mwaeckerlin, '%' is the default if nothing is supplied:

https://github.com/docker-library/mysql/blob/fc3e856313423dc2d6a8d74cfd6b678582090fc7/5.7/docker-entrypoint.sh#L149

https://github.com/docker-library/mysql/blob/fc3e856313423dc2d6a8d74cfd6b678582090fc7/5.7/docker-entrypoint.sh#L21

And the non-root user is always %:

https://github.com/docker-library/mysql/blob/fc3e856313423dc2d6a8d74cfd6b678582090fc7/5.7/docker-entrypoint.sh#L184

As I mentioned above, your issue is probably #405 (and related issue #419). You need to either use mysql:5.7 as your image, or add --default-authentication-plugin=mysql_native_password to your command. (I don't know why commenting out the non-root user makes your setup work, but if you can create a minimal reproducible case you could file a new issue)

mwaeckerlin commented 6 years ago

@yosifkit , this is the minimum reproducible case that I posted in May: https://github.com/docker-library/mysql/issues/275#issuecomment-387735349

KarelWintersky commented 6 years ago

Not a docker-compose solution, just a console only:

docker run 
--rm 
--name mysql
-p 6603:3306
--env="MYSQL_ROOT_HOST=%"
--env="MYSQL_USER=username" 
--env="MYSQL_PASSWORD=password" 
--env="MYSQL_GENERAL_LOG=1" 
--env="MYSQL_ROOT_PASSWORD=password" 
--mount type=bind,src=/srv/databases/mysql57.docked,dst=/var/lib/mysql 
--mount type=bind,src=/srv/databases/mysql-5.7.cnf,dst=/etc/my.cnf 
mysql/mysql-server:5.7

So, we can use:

mysql --host=0.0.0.0 --port=6603 --user=username --password=password --prompt "MySQL 5.7 > "

or

mysql --host=0.0.0.0 --port=6603 --user=root --password=password --prompt "MySQL 5.7 > "

If it works - remove --rm key and add -d detach option.

yosifkit commented 6 years ago

I switched both tests to mysql:5.7, since 8.0 is now latest and fails in both tests as I linked above. I assume that you just haven't pulled latest recently, otherwise you would get similar errors. I also just used a relative directory for the mysql mount so it works for anyone to test.

I am unable to reproduce the failures you are seeing; both tests work fine. Do you have an already initialized mysql data directory? The environment variables are only used if the data directory is empty: see also https://github.com/docker-library/postgres/issues/203#issuecomment-255200501.

compose-file and output of first run: ```yaml # removed some superfluous volumes/ports since WordPress is not the target of the test (and wouldn't effect mysql) version: '3.3' services: mysql: image: mysql:5.7 volumes: - type: bind source: ./mysql target: /var/lib/mysql environment: - 'MYSQL_DATABASE=wordpress' - 'MYSQL_USER=wordpress' - 'MYSQL_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei' - 'MYSQL_ROOT_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he' command: --log-bin=/var/lib/mysql/mysql-bin.log --binlog-format=ROW --server-id=1 wordpress: image: wordpress environment: - 'WORDPRESS_DB_HOST=mysql' - 'WORDPRESS_DB_NAME=wordpress' - 'WORDPRESS_DB_USER=wordpress' - 'WORDPRESS_DB_PASSWORD=iy1ieWaiphoofeixogai0quai0eevu2Vah9Aecei' ``` ```console $ docker-compose up Creating wordpress_mysql_1 ... Creating wordpress_wordpress_1 ... Creating wordpress_mysql_1 Creating wordpress_mysql_1 ... done Attaching to wordpress_wordpress_1, wordpress_mysql_1 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 mysql_1 | Initializing database mysql_1 | 2018-07-12T19:56:25.946961Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T19:56:26.295320Z 0 [Warning] InnoDB: New log files created, LSN=45790 mysql_1 | 2018-07-12T19:56:26.391711Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. mysql_1 | 2018-07-12T19:56:26.484266Z 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: a91e7487-860d-11e8-a51a-0242ac140003. mysql_1 | 2018-07-12T19:56:26.489024Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. mysql_1 | 2018-07-12T19:56:26.494290Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. mysql_1 | 2018-07-12T19:56:28.177067Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177127Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177156Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177198Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177212Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177238Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177335Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:28.177365Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | Database initialized mysql_1 | Initializing certificates mysql_1 | Generating a 2048 bit RSA private key mysql_1 | ..+++ mysql_1 | ........................................................+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'ca-key.pem' mysql_1 | ----- mysql_1 | Generating a 2048 bit RSA private key mysql_1 | ........................................................+++ mysql_1 | ...............+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'server-key.pem' mysql_1 | ----- mysql_1 | Generating a 2048 bit RSA private key mysql_1 | .....................................................+++ mysql_1 | ..........+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'client-key.pem' mysql_1 | ----- mysql_1 | Certificates initialized mysql_1 | MySQL init process in progress... mysql_1 | 2018-07-12T19:56:30.755658Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T19:56:30.756566Z 0 [Note] mysqld (mysqld 5.7.22-log) starting as process 92 ... mysql_1 | 2018-07-12T19:56:30.760011Z 0 [Note] InnoDB: PUNCH HOLE support available mysql_1 | 2018-07-12T19:56:30.760023Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mysql_1 | 2018-07-12T19:56:30.760026Z 0 [Note] InnoDB: Uses event mutexes mysql_1 | 2018-07-12T19:56:30.760027Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier mysql_1 | 2018-07-12T19:56:30.760029Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 mysql_1 | 2018-07-12T19:56:30.760030Z 0 [Note] InnoDB: Using Linux native AIO mysql_1 | 2018-07-12T19:56:30.760156Z 0 [Note] InnoDB: Number of pools: 1 mysql_1 | 2018-07-12T19:56:30.760215Z 0 [Note] InnoDB: Using CPU crc32 instructions mysql_1 | 2018-07-12T19:56:30.761023Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M mysql_1 | 2018-07-12T19:56:30.765402Z 0 [Note] InnoDB: Completed initialization of buffer pool mysql_1 | 2018-07-12T19:56:30.766517Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mysql_1 | 2018-07-12T19:56:30.778559Z 0 [Note] InnoDB: Highest supported file format is Barracuda. mysql_1 | 2018-07-12T19:56:30.789733Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables mysql_1 | 2018-07-12T19:56:30.789792Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mysql_1 | 2018-07-12T19:56:30.815454Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mysql_1 | 2018-07-12T19:56:30.817527Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. mysql_1 | 2018-07-12T19:56:30.817554Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. mysql_1 | 2018-07-12T19:56:30.818284Z 0 [Note] InnoDB: Waiting for purge to start mysql_1 | 2018-07-12T19:56:30.868524Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 2589156 mysql_1 | 2018-07-12T19:56:30.868881Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T19:56:30.869443Z 0 [Note] Plugin 'FEDERATED' is disabled. mysql_1 | 2018-07-12T19:56:30.872772Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180712 19:56:30 mysql_1 | 2018-07-12T19:56:30.906201Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. mysql_1 | 2018-07-12T19:56:30.906786Z 0 [Warning] CA certificate ca.pem is self signed. mysql_1 | 2018-07-12T19:56:30.914926Z 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. mysql_1 | 2018-07-12T19:56:30.917586Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.917653Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.917677Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.917713Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.917725Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.917749Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.920948Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.920992Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:30.936254Z 0 [Note] Event Scheduler: Loaded 0 events mysql_1 | 2018-07-12T19:56:30.936534Z 0 [Note] mysqld: ready for connections. mysql_1 | Version: '5.7.22-log' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL) wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it. mysql_1 | 2018-07-12T19:56:33.811178Z 4 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.811608Z 4 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.811690Z 4 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.811777Z 4 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.811819Z 4 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.811861Z 4 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.812029Z 4 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.812082Z 4 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | mysql: [Warning] Using a password on the command line interface can be insecure. mysql_1 | mysql: [Warning] Using a password on the command line interface can be insecure. mysql_1 | mysql: [Warning] Using a password on the command line interface can be insecure. mysql_1 | mysql: [Warning] Using a password on the command line interface can be insecure. mysql_1 | 2018-07-12T19:56:33.851476Z 8 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851490Z 8 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851495Z 8 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851506Z 8 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851509Z 8 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851514Z 8 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851599Z 8 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:33.851605Z 8 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | mysql_1 | 2018-07-12T19:56:33.857409Z 0 [Note] Giving 0 client threads a chance to die gracefully mysql_1 | 2018-07-12T19:56:33.857429Z 0 [Note] Shutting down slave threads mysql_1 | 2018-07-12T19:56:33.857434Z 0 [Note] Forcefully disconnecting 0 remaining clients mysql_1 | 2018-07-12T19:56:33.857440Z 0 [Note] Event Scheduler: Purging the queue. 0 events mysql_1 | 2018-07-12T19:56:33.857659Z 0 [Note] Binlog end mysql_1 | 2018-07-12T19:56:33.862502Z 0 [Note] Shutting down plugin 'ngram' mysql_1 | 2018-07-12T19:56:33.862521Z 0 [Note] Shutting down plugin 'partition' mysql_1 | 2018-07-12T19:56:33.862526Z 0 [Note] Shutting down plugin 'BLACKHOLE' mysql_1 | 2018-07-12T19:56:33.862530Z 0 [Note] Shutting down plugin 'ARCHIVE' mysql_1 | 2018-07-12T19:56:33.862532Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' mysql_1 | 2018-07-12T19:56:33.862564Z 0 [Note] Shutting down plugin 'MRG_MYISAM' mysql_1 | 2018-07-12T19:56:33.862571Z 0 [Note] Shutting down plugin 'MyISAM' mysql_1 | 2018-07-12T19:56:33.862585Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL' mysql_1 | 2018-07-12T19:56:33.862593Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' mysql_1 | 2018-07-12T19:56:33.862599Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' mysql_1 | 2018-07-12T19:56:33.862602Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' mysql_1 | 2018-07-12T19:56:33.862606Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' mysql_1 | 2018-07-12T19:56:33.862610Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' mysql_1 | 2018-07-12T19:56:33.862613Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' mysql_1 | 2018-07-12T19:56:33.862617Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' mysql_1 | 2018-07-12T19:56:33.862621Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' mysql_1 | 2018-07-12T19:56:33.862625Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES' mysql_1 | 2018-07-12T19:56:33.862629Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' mysql_1 | 2018-07-12T19:56:33.862633Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' mysql_1 | 2018-07-12T19:56:33.862636Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG' mysql_1 | 2018-07-12T19:56:33.862640Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' mysql_1 | 2018-07-12T19:56:33.862645Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED' mysql_1 | 2018-07-12T19:56:33.862649Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' mysql_1 | 2018-07-12T19:56:33.862653Z 0 [Note] Shutting down plugin 'INNODB_METRICS' mysql_1 | 2018-07-12T19:56:33.862657Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO' mysql_1 | 2018-07-12T19:56:33.862661Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' mysql_1 | 2018-07-12T19:56:33.862665Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' mysql_1 | 2018-07-12T19:56:33.862668Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' mysql_1 | 2018-07-12T19:56:33.862672Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' mysql_1 | 2018-07-12T19:56:33.862676Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' mysql_1 | 2018-07-12T19:56:33.862680Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' mysql_1 | 2018-07-12T19:56:33.862684Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM' mysql_1 | 2018-07-12T19:56:33.862688Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET' mysql_1 | 2018-07-12T19:56:33.862692Z 0 [Note] Shutting down plugin 'INNODB_CMP' mysql_1 | 2018-07-12T19:56:33.862696Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' mysql_1 | 2018-07-12T19:56:33.862700Z 0 [Note] Shutting down plugin 'INNODB_LOCKS' mysql_1 | 2018-07-12T19:56:33.862704Z 0 [Note] Shutting down plugin 'INNODB_TRX' mysql_1 | 2018-07-12T19:56:33.862708Z 0 [Note] Shutting down plugin 'InnoDB' mysql_1 | 2018-07-12T19:56:33.862790Z 0 [Note] InnoDB: FTS optimize thread exiting. mysql_1 | 2018-07-12T19:56:33.862863Z 0 [Note] InnoDB: Starting shutdown... mysql_1 | 2018-07-12T19:56:33.963061Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T19:56:33.963613Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180712 19:56:33 wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | 2018-07-12T19:56:35.798362Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12358855 mysql_1 | 2018-07-12T19:56:35.802695Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" mysql_1 | 2018-07-12T19:56:35.802756Z 0 [Note] Shutting down plugin 'MEMORY' mysql_1 | 2018-07-12T19:56:35.802766Z 0 [Note] Shutting down plugin 'CSV' mysql_1 | 2018-07-12T19:56:35.802774Z 0 [Note] Shutting down plugin 'sha256_password' mysql_1 | 2018-07-12T19:56:35.802780Z 0 [Note] Shutting down plugin 'mysql_native_password' mysql_1 | 2018-07-12T19:56:35.803201Z 0 [Note] Shutting down plugin 'binlog' mysql_1 | 2018-07-12T19:56:35.805996Z 0 [Note] mysqld: Shutdown complete mysql_1 | mysql_1 | mysql_1 | MySQL init process done. Ready for start up. mysql_1 | mysql_1 | 2018-07-12T19:56:36.026030Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T19:56:36.026893Z 0 [Note] mysqld (mysqld 5.7.22-log) starting as process 1 ... mysql_1 | 2018-07-12T19:56:36.029160Z 0 [Note] InnoDB: PUNCH HOLE support available mysql_1 | 2018-07-12T19:56:36.029174Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mysql_1 | 2018-07-12T19:56:36.029176Z 0 [Note] InnoDB: Uses event mutexes mysql_1 | 2018-07-12T19:56:36.029177Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier mysql_1 | 2018-07-12T19:56:36.029179Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 mysql_1 | 2018-07-12T19:56:36.029180Z 0 [Note] InnoDB: Using Linux native AIO mysql_1 | 2018-07-12T19:56:36.029348Z 0 [Note] InnoDB: Number of pools: 1 mysql_1 | 2018-07-12T19:56:36.029431Z 0 [Note] InnoDB: Using CPU crc32 instructions mysql_1 | 2018-07-12T19:56:36.030452Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M mysql_1 | 2018-07-12T19:56:36.034714Z 0 [Note] InnoDB: Completed initialization of buffer pool mysql_1 | 2018-07-12T19:56:36.035940Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mysql_1 | 2018-07-12T19:56:36.048367Z 0 [Note] InnoDB: Highest supported file format is Barracuda. mysql_1 | 2018-07-12T19:56:36.062034Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables mysql_1 | 2018-07-12T19:56:36.062105Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mysql_1 | 2018-07-12T19:56:36.091733Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mysql_1 | 2018-07-12T19:56:36.093814Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. mysql_1 | 2018-07-12T19:56:36.093843Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. mysql_1 | 2018-07-12T19:56:36.094616Z 0 [Note] InnoDB: Waiting for purge to start mysql_1 | 2018-07-12T19:56:36.144871Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 12358855 mysql_1 | 2018-07-12T19:56:36.145244Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T19:56:36.145723Z 0 [Note] Plugin 'FEDERATED' is disabled. mysql_1 | 2018-07-12T19:56:36.153557Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180712 19:56:36 mysql_1 | 2018-07-12T19:56:36.202631Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. mysql_1 | 2018-07-12T19:56:36.202880Z 0 [Warning] CA certificate ca.pem is self signed. mysql_1 | 2018-07-12T19:56:36.205400Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 mysql_1 | 2018-07-12T19:56:36.205435Z 0 [Note] IPv6 is available. mysql_1 | 2018-07-12T19:56:36.205738Z 0 [Note] - '::' resolves to '::'; mysql_1 | 2018-07-12T19:56:36.205756Z 0 [Note] Server socket created on IP: '::'. mysql_1 | 2018-07-12T19:56:36.206545Z 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. mysql_1 | 2018-07-12T19:56:36.207556Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.207581Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.207593Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.207623Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.207630Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.207642Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.209329Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.209341Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T19:56:36.214203Z 0 [Note] Event Scheduler: Loaded 0 events mysql_1 | 2018-07-12T19:56:36.214320Z 0 [Note] mysqld: ready for connections. mysql_1 | Version: '5.7.22-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.2. Set the 'ServerName' directive globally to suppress this message wordpress_1 | [Thu Jul 12 19:56:38.079104 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.7 configured -- resuming normal operations wordpress_1 | [Thu Jul 12 19:56:38.079408 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND' ```
compose-file and output of second run: ```yaml version: '3.3' services: mysql: image: mysql volumes: - type: bind source: ./mysql target: /var/lib/mysql environment: - 'MYSQL_ROOT_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he' - 'MYSQL_ROOT_HOST=%' command: --log-bin=/var/lib/mysql/mysql-bin.log --binlog-format=ROW --server-id=1 wordpress: image: wordpress environment: - 'WORDPRESS_DB_PASSWORD=theeNgiHohzeph4LooW5iepohXei6Lieje8zo1he' ``` ```console $ # start with an empty sql data dir $ sudo rm -rf ./mysql Password: $ ls -ln total 4 -rw-rw-r-- 1 1000 1000 476 Jul 12 12:44 docker-compose.yml $ docker-compose up Creating wordpress_mysql_1 ... Creating wordpress_wordpress_1 ... Creating wordpress_mysql_1 Creating wordpress_mysql_1 ... done Attaching to wordpress_wordpress_1, wordpress_mysql_1 wordpress_1 | WordPress not found in /var/www/html - copying now... wordpress_1 | Complete! WordPress has been successfully copied to /var/www/html mysql_1 | Initializing database mysql_1 | 2018-07-12T20:04:55.323502Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T20:04:55.570669Z 0 [Warning] InnoDB: New log files created, LSN=45790 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 mysql_1 | 2018-07-12T20:04:55.646909Z 0 [Warning] InnoDB: Creating foreign key constraint system tables. mysql_1 | 2018-07-12T20:04:55.731029Z 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: d8a75842-860e-11e8-831a-0242ac140002. mysql_1 | 2018-07-12T20:04:55.736590Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened. mysql_1 | 2018-07-12T20:04:55.741824Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option. mysql_1 | 2018-07-12T20:04:57.416437Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416502Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416528Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416566Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416588Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416619Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416727Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:04:57.416752Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | Database initialized mysql_1 | Initializing certificates mysql_1 | Generating a 2048 bit RSA private key mysql_1 | ...........................................................................+++ mysql_1 | .....................................................................................+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'ca-key.pem' mysql_1 | ----- mysql_1 | Generating a 2048 bit RSA private key mysql_1 | .........................+++ mysql_1 | .......................................................................................+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'server-key.pem' mysql_1 | ----- mysql_1 | Generating a 2048 bit RSA private key mysql_1 | ..................................................+++ mysql_1 | ................................................................................................................................+++ mysql_1 | unable to write 'random state' mysql_1 | writing new private key to 'client-key.pem' mysql_1 | ----- mysql_1 | Certificates initialized mysql_1 | MySQL init process in progress... mysql_1 | 2018-07-12T20:05:00.265790Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T20:05:00.266652Z 0 [Note] mysqld (mysqld 5.7.22-log) starting as process 93 ... mysql_1 | 2018-07-12T20:05:00.268935Z 0 [Note] InnoDB: PUNCH HOLE support available mysql_1 | 2018-07-12T20:05:00.268945Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mysql_1 | 2018-07-12T20:05:00.268948Z 0 [Note] InnoDB: Uses event mutexes mysql_1 | 2018-07-12T20:05:00.268949Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier mysql_1 | 2018-07-12T20:05:00.268951Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 mysql_1 | 2018-07-12T20:05:00.268952Z 0 [Note] InnoDB: Using Linux native AIO mysql_1 | 2018-07-12T20:05:00.269081Z 0 [Note] InnoDB: Number of pools: 1 mysql_1 | 2018-07-12T20:05:00.269136Z 0 [Note] InnoDB: Using CPU crc32 instructions mysql_1 | 2018-07-12T20:05:00.270001Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M mysql_1 | 2018-07-12T20:05:00.274405Z 0 [Note] InnoDB: Completed initialization of buffer pool mysql_1 | 2018-07-12T20:05:00.275501Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mysql_1 | 2018-07-12T20:05:00.287687Z 0 [Note] InnoDB: Highest supported file format is Barracuda. mysql_1 | 2018-07-12T20:05:00.303034Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables mysql_1 | 2018-07-12T20:05:00.303112Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mysql_1 | 2018-07-12T20:05:00.333390Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mysql_1 | 2018-07-12T20:05:00.335412Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. mysql_1 | 2018-07-12T20:05:00.335435Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. mysql_1 | 2018-07-12T20:05:00.336340Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 2589156 mysql_1 | 2018-07-12T20:05:00.336718Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T20:05:00.337117Z 0 [Note] Plugin 'FEDERATED' is disabled. mysql_1 | 2018-07-12T20:05:00.340583Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180712 20:05:00 mysql_1 | 2018-07-12T20:05:00.370743Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. mysql_1 | 2018-07-12T20:05:00.371252Z 0 [Warning] CA certificate ca.pem is self signed. mysql_1 | 2018-07-12T20:05:00.378919Z 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. mysql_1 | 2018-07-12T20:05:00.382009Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.382073Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.382100Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.382140Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.382150Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.382171Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.385567Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.385607Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:00.397239Z 0 [Note] Event Scheduler: Loaded 0 events mysql_1 | 2018-07-12T20:05:00.397488Z 0 [Note] mysqld: ready for connections. mysql_1 | Version: '5.7.22-log' socket: '/var/run/mysqld/mysqld.sock' port: 0 MySQL Community Server (GPL) wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it. mysql_1 | Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it. mysql_1 | 2018-07-12T20:05:03.283222Z 4 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283279Z 4 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283301Z 4 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283345Z 4 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283358Z 4 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283403Z 4 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283599Z 4 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:03.283625Z 4 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | mysql_1 | 2018-07-12T20:05:03.286572Z 0 [Note] Giving 0 client threads a chance to die gracefully mysql_1 | 2018-07-12T20:05:03.286619Z 0 [Note] Shutting down slave threads mysql_1 | 2018-07-12T20:05:03.286629Z 0 [Note] Forcefully disconnecting 0 remaining clients mysql_1 | 2018-07-12T20:05:03.286639Z 0 [Note] Event Scheduler: Purging the queue. 0 events mysql_1 | 2018-07-12T20:05:03.286772Z 0 [Note] Binlog end mysql_1 | 2018-07-12T20:05:03.293542Z 0 [Note] Shutting down plugin 'ngram' mysql_1 | 2018-07-12T20:05:03.293575Z 0 [Note] Shutting down plugin 'partition' mysql_1 | 2018-07-12T20:05:03.293584Z 0 [Note] Shutting down plugin 'BLACKHOLE' mysql_1 | 2018-07-12T20:05:03.293590Z 0 [Note] Shutting down plugin 'ARCHIVE' mysql_1 | 2018-07-12T20:05:03.293595Z 0 [Note] Shutting down plugin 'PERFORMANCE_SCHEMA' mysql_1 | 2018-07-12T20:05:03.293654Z 0 [Note] Shutting down plugin 'MRG_MYISAM' mysql_1 | 2018-07-12T20:05:03.293665Z 0 [Note] Shutting down plugin 'MyISAM' mysql_1 | 2018-07-12T20:05:03.293684Z 0 [Note] Shutting down plugin 'INNODB_SYS_VIRTUAL' mysql_1 | 2018-07-12T20:05:03.293695Z 0 [Note] Shutting down plugin 'INNODB_SYS_DATAFILES' mysql_1 | 2018-07-12T20:05:03.293700Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESPACES' mysql_1 | 2018-07-12T20:05:03.293705Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN_COLS' mysql_1 | 2018-07-12T20:05:03.293712Z 0 [Note] Shutting down plugin 'INNODB_SYS_FOREIGN' mysql_1 | 2018-07-12T20:05:03.293716Z 0 [Note] Shutting down plugin 'INNODB_SYS_FIELDS' mysql_1 | 2018-07-12T20:05:03.293721Z 0 [Note] Shutting down plugin 'INNODB_SYS_COLUMNS' mysql_1 | 2018-07-12T20:05:03.293726Z 0 [Note] Shutting down plugin 'INNODB_SYS_INDEXES' mysql_1 | 2018-07-12T20:05:03.293731Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLESTATS' mysql_1 | 2018-07-12T20:05:03.293736Z 0 [Note] Shutting down plugin 'INNODB_SYS_TABLES' mysql_1 | 2018-07-12T20:05:03.293741Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_TABLE' mysql_1 | 2018-07-12T20:05:03.293747Z 0 [Note] Shutting down plugin 'INNODB_FT_INDEX_CACHE' mysql_1 | 2018-07-12T20:05:03.293754Z 0 [Note] Shutting down plugin 'INNODB_FT_CONFIG' mysql_1 | 2018-07-12T20:05:03.293762Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED' mysql_1 | 2018-07-12T20:05:03.293768Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED' mysql_1 | 2018-07-12T20:05:03.293773Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD' mysql_1 | 2018-07-12T20:05:03.293778Z 0 [Note] Shutting down plugin 'INNODB_METRICS' mysql_1 | 2018-07-12T20:05:03.293783Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO' mysql_1 | 2018-07-12T20:05:03.293788Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS' mysql_1 | 2018-07-12T20:05:03.293793Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU' mysql_1 | 2018-07-12T20:05:03.293798Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE' mysql_1 | 2018-07-12T20:05:03.293803Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET' mysql_1 | 2018-07-12T20:05:03.293808Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX' mysql_1 | 2018-07-12T20:05:03.293815Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET' mysql_1 | 2018-07-12T20:05:03.293820Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM' mysql_1 | 2018-07-12T20:05:03.293825Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET' mysql_1 | 2018-07-12T20:05:03.293831Z 0 [Note] Shutting down plugin 'INNODB_CMP' mysql_1 | 2018-07-12T20:05:03.293840Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS' mysql_1 | 2018-07-12T20:05:03.293846Z 0 [Note] Shutting down plugin 'INNODB_LOCKS' mysql_1 | 2018-07-12T20:05:03.293852Z 0 [Note] Shutting down plugin 'INNODB_TRX' mysql_1 | 2018-07-12T20:05:03.293857Z 0 [Note] Shutting down plugin 'InnoDB' mysql_1 | 2018-07-12T20:05:03.293991Z 0 [Note] InnoDB: FTS optimize thread exiting. mysql_1 | 2018-07-12T20:05:03.294131Z 0 [Note] InnoDB: Starting shutdown... mysql_1 | 2018-07-12T20:05:03.394392Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T20:05:03.394854Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 180712 20:05:03 wordpress_1 | wordpress_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in Standard input code on line 22 wordpress_1 | wordpress_1 | MySQL Connection Error: (2002) Connection refused mysql_1 | 2018-07-12T20:05:05.224998Z 0 [Note] InnoDB: Shutdown completed; log sequence number 12358855 mysql_1 | 2018-07-12T20:05:05.229123Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1" mysql_1 | 2018-07-12T20:05:05.229156Z 0 [Note] Shutting down plugin 'MEMORY' mysql_1 | 2018-07-12T20:05:05.229169Z 0 [Note] Shutting down plugin 'CSV' mysql_1 | 2018-07-12T20:05:05.229180Z 0 [Note] Shutting down plugin 'sha256_password' mysql_1 | 2018-07-12T20:05:05.229188Z 0 [Note] Shutting down plugin 'mysql_native_password' mysql_1 | 2018-07-12T20:05:05.229614Z 0 [Note] Shutting down plugin 'binlog' mysql_1 | 2018-07-12T20:05:05.232018Z 0 [Note] mysqld: Shutdown complete mysql_1 | mysql_1 | mysql_1 | MySQL init process done. Ready for start up. mysql_1 | mysql_1 | 2018-07-12T20:05:05.455669Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). mysql_1 | 2018-07-12T20:05:05.456545Z 0 [Note] mysqld (mysqld 5.7.22-log) starting as process 1 ... mysql_1 | 2018-07-12T20:05:05.458950Z 0 [Note] InnoDB: PUNCH HOLE support available mysql_1 | 2018-07-12T20:05:05.458960Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mysql_1 | 2018-07-12T20:05:05.458963Z 0 [Note] InnoDB: Uses event mutexes mysql_1 | 2018-07-12T20:05:05.458965Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier mysql_1 | 2018-07-12T20:05:05.458966Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3 mysql_1 | 2018-07-12T20:05:05.458968Z 0 [Note] InnoDB: Using Linux native AIO mysql_1 | 2018-07-12T20:05:05.459108Z 0 [Note] InnoDB: Number of pools: 1 mysql_1 | 2018-07-12T20:05:05.459169Z 0 [Note] InnoDB: Using CPU crc32 instructions mysql_1 | 2018-07-12T20:05:05.459955Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M mysql_1 | 2018-07-12T20:05:05.464150Z 0 [Note] InnoDB: Completed initialization of buffer pool mysql_1 | 2018-07-12T20:05:05.465289Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mysql_1 | 2018-07-12T20:05:05.477454Z 0 [Note] InnoDB: Highest supported file format is Barracuda. mysql_1 | 2018-07-12T20:05:05.490801Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables mysql_1 | 2018-07-12T20:05:05.490870Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mysql_1 | 2018-07-12T20:05:05.520772Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mysql_1 | 2018-07-12T20:05:05.522830Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active. mysql_1 | 2018-07-12T20:05:05.522860Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active. mysql_1 | 2018-07-12T20:05:05.523863Z 0 [Note] InnoDB: 5.7.22 started; log sequence number 12358855 mysql_1 | 2018-07-12T20:05:05.524157Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mysql_1 | 2018-07-12T20:05:05.524714Z 0 [Note] Plugin 'FEDERATED' is disabled. mysql_1 | 2018-07-12T20:05:05.533573Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180712 20:05:05 mysql_1 | 2018-07-12T20:05:05.580642Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them. mysql_1 | 2018-07-12T20:05:05.581004Z 0 [Warning] CA certificate ca.pem is self signed. mysql_1 | 2018-07-12T20:05:05.585098Z 0 [Note] Server hostname (bind-address): '*'; port: 3306 mysql_1 | 2018-07-12T20:05:05.585151Z 0 [Note] IPv6 is available. mysql_1 | 2018-07-12T20:05:05.585181Z 0 [Note] - '::' resolves to '::'; mysql_1 | 2018-07-12T20:05:05.585198Z 0 [Note] Server socket created on IP: '::'. mysql_1 | 2018-07-12T20:05:05.586050Z 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. mysql_1 | 2018-07-12T20:05:05.587311Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.587349Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.587364Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.587415Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.587426Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.587441Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.590044Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.590070Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode. mysql_1 | 2018-07-12T20:05:05.596310Z 0 [Note] Event Scheduler: Loaded 0 events mysql_1 | 2018-07-12T20:05:05.596456Z 0 [Note] mysqld: ready for connections. mysql_1 | Version: '5.7.22-log' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL) wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message wordpress_1 | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.3. Set the 'ServerName' directive globally to suppress this message wordpress_1 | [Thu Jul 12 20:05:07.712423 2018] [mpm_prefork:notice] [pid 1] AH00163: Apache/2.4.25 (Debian) PHP/7.2.7 configured -- resuming normal operations wordpress_1 | [Thu Jul 12 20:05:07.712449 2018] [core:notice] [pid 1] AH00094: Command line: 'apache2 -D FOREGROUND' ```
cccaballero commented 6 years ago

Hi, I am getting this error with the mysql:5.7 image, but three weeks ago this was not happening.

kadimi commented 6 years ago

This comment was helpful.

I had this:

  volumes:
    - ./data/db:/var/lib/mysql

Using this fixed it:

  volumes:
    - ./db:/var/lib/mysql
Lipathor commented 6 years ago

Similar problem here, mysql:8 up and running with docker-compose. I've created user administrator@% to create databases and another users. I'm logged in as administrator in adminer (same project as mysql), then i run jenkins, and it runs PHP script that create new database and user and grant user privileges to database. After that when i refresh adminer, im logged out and can't login again - i got message:

SQLSTATE[HY000] [1045] Access denied for user 'administrator'@'mysql_adminer_1.mysqlGlobal' (using password: YES)

with CLI i am still able to connect and login, with the same credentials...