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?
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.
I resolved removing the volumes configuration.
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
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.
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?
@s1dekick223
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:
docker exec -it your_container_name_or_id bash
mysql -u your_user -p
It will ask you your password, you have to write it and press enter.
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.
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:
docker exec -it your_container_name_or_id bash
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.
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.
Using
docker-compose, if you link a volume, the parametersenvironment: MYSQL_ROOT_PASSWORD: 'pass' MYSQL_DATABASE: 'db' MYSQL_USER: 'user' MYSQL_PASSWORD: 'pass'in your
docker-compose.ymlwill 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.
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.
please @lucile-sticky my bind-address is '*' how do i edit it to '0.0.0.0'??? Thanks
@LordRahl90 to change the bind-address option, you have to:
[mysqld], add bind-address=0.0.0.0Example:
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 "[email protected]"
# 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.
@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?
@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.
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']).
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.
I fixed executing this command on docker container:
# mysql_secure_installation
@Danisan me too. Did you find the solution?
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.
@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.
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'@'%';
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"
@ 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?
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).
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:
You need .env file
DATABASE_NAME=DBNAME
DATABASE_HOST=127.0.0.1
DATABASE_PASSWORD=DBPASS
DATABASE_USERNAME=ROOTNAME
docker run -p 3306:3306 --name mysql2 -e MYSQL_ROOT_PASSWORD=b3RmELKOvCUrAdxIg0GEmugc3SY -e MYSQL_ROOT_HOST=% -d mysql/mysql-server:latest
Hostname: 0.0.0.0
Port: 3306
Username: root
Password: b3RmELKOvCUrAdxIg0GEmugc3SY [mysql random secret]
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();
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)
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.
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:
docker-compose down on other projects that used the mysql:5.7 image.MYSQL_ROOT_PASSWORD env var (I am not completely sure if this is relevant).docker-compose up --build --force-recreate -d.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.
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.
i have some problems. My docker-compose.yml:
version: '2'
services:
nginx:
image: nginx:latest
ports:
- "80:80"
- "443:443"
volumes:
- ./hosts:/etc/nginx/conf.d
- ./www:/var/www
- ./logs:/var/log/nginx
links:
- php
php:
build: ./images/php
links:
- mysql
volumes:
- ./www:/var/www
mysql:
image: mysql:latest
ports:
- "3306:3306"
volumes:
- ./mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
command: mysqld --sql-mode=NO_ENGINE_SUBSTITUTION
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?
@Montego rm the old containers from this build and try to run start it with
docker-compose up -d
@s1dekick223 sorry for maybe stupid question, but how can i rm the old containers from this build correctly?
@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
@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"
@Montego go into the root where your docker-compose.yml is start terminal and use
docker-compose stop
to shut them down
@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 :(
@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 ^^
@s1dekick223 about 5-10 seconds :)
I can't resolve this problem about 3 days and this is killing me slowly >_<
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.
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?
@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
adding
environment:
- MYSQL_ROOT_HOST=%
fix my problem
@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.
@mwaeckerlin, '%' is the default if nothing is supplied:
And the non-root user is always %:
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)
@yosifkit , this is the minimum reproducible case that I posted in May: https://github.com/docker-library/mysql/issues/275#issuecomment-387735349
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.
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:
# 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'
$ 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:
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'
$ # 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'
Hi, I am getting this error with the mysql:5.7 image, but three weeks ago this was not happening.
This comment was helpful.
I had this:
volumes:
- ./data/db:/var/lib/mysql
Using this fixed it:
volumes:
- ./db:/var/lib/mysql
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...
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'@'%';
It's working for me. Thank @meenakshik-optimus
Well, it worked with new user@%, but first i had to delete every mysql data and initialize it again. No idea, why it didn't work and works now. Initialization bug?
The problem was fixed by add env MYSQL_ROOT_HOST=%, thanks all of you.
For me MYSQL_ROOT_HOST=% didn't work. After examining the docker-entrypoint.sh, it turned out that this environment variable only works when you mount a volume for your database. I didn't, so setting MYSQL_ROOT_HOST=% did nothing for me. I fixed that by extending the base image to allow root to log in without password from any host and have all privileges:
Dockerfile:
FROM mysql/mysql-server:5.7
COPY root-config.sql /docker-entrypoint-initdb.d/root-config.sql
ENV MYSQL_ROOT_PASSWORD ''
ENV MYSQL_ALLOW_EMPTY_PASSWORD 1
ENV MYSQL_DATABASE mydb
root-config.sql:
CREATE USER 'root'@'%' IDENTIFIED BY '' ;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
Since you can ping container_name and docker DNS resolves which container you want to use, would it not make more sense to use create user 'database_user'@'[container_name]' instead?
Since you can ping
container_nameand docker DNS resolves which container you want to use, would it not make more sense to usecreate user 'database_user'@'[container_name]'instead?
No, it makes no sense. The mysql docker image must be generic and it does not know [the client's] container name.
[edited due to the following comment]
I never claimed that you should use its own container name as the hostname, but instead the container name of the service that would use the said database.
I never claimed that you should use its own container name as the hostname, but instead the container name of the service that would use the said database.
Sorry, my fault, but it is the same problem vice versa: The mysql docker container has absolutely no knowledge of the container that is using it. The mysql server is independent of the client. Only the client needs to know how to reach the server. I updated my comment above.
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'@'%';
worked for me. Along that added volume
volumes:
- ./mysqldata:/var/lib/mysql:rw,delegated
i hava the same problem, it is ok in my mac but problem in my linux..
I had this similar 'not allowed to connect' issue and solved it; so I'd like to share.
TL;DR
If you stand up your MySQL container for the very first time, with an empty mounted volume, without the MYSQL_ROOT_HOST: '%' environment variable set; your databases will initialize and "block" your host (since it's not defined).
Long Version
I've been iteratively building on my docker-compose file. I started with this
db:
image: mysql:8.0
volumes:
- ./database:/var/lib/mysql
ports:
- 3306:3306
# Use root/example as user/password credentials
environment:
MYSQL_ROOT_PASSWORD: example
I tried to login from MySQL workbench using root:example and got the connection issue.
I then deleted everything in the ./database directory.
I added the following:
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_ROOT_HOST: '%'
Then I stood my MySQL container back up, it rebuilt the databases while taking the wildcard host % into account and now I can connect just fine.
MYSQL_ROOT_HOST: '%' is my solution! Thanks!
MYSQL_ROOT_HOST is not required; the default is already %:
https://github.com/docker-library/mysql/blob/a7a737f1eb44db467c85c8229df9d886dd63460e/8.0/docker-entrypoint.sh#L150-L151
For some reason, this is happening again. My dockerfile is
version: '2'
services:
web:
build:
context: ./
dockerfile: web.docker
volumes:
- ./:/var/www
ports:
- "8097:97"
links:
- app
app:
build:
context: ./
dockerfile: app.docker
volumes:
- ./:/var/www
links:
- database
environment:
- "DB_PORT=3306"
- "DB_HOST=database"
database:
image: mysql:5.7
command: --init-file /tmp/phpunit-database.sql
volumes:
- ./phpunit-database.sql:/tmp/phpunit-database.sql
environment:
- "MYSQL_ROOT_PASSWORD=secret"
- "MYSQL_DATABASE=dockerApp_sing"
ports:
- "33067:3306"
No clue. Already tried 'MYSQL_ROOT_HOST=%' and removing the 'volumes'
@kasun-rhino, don't use init-file. I am quite sure the image is not designed to handle that; especially since that will be imported my MySQL before the entrypoint script has a chance to create the root user and requested database. Instead drop your .sql file in /docker-entrypoint-initdb.d/ and it will be automatically used on first initialization (https://github.com/docker-library/docs/tree/71ef75f7db8dc71a803ce5d1d2be997ba0eda610/mysql#initializing-a-fresh-instance)
I faced this problem and I fixed it collecting some of the answers here (@lucile-sticky and @tarikhagustia), but I did it using Kitematic.
This was my approach:

When you create a new MySQL container, or use an existing one, make sure you have deleted the contents on the volume used by this container before starting the container. You can check the local folder in the "Volumes" tab.

The container will ask you to assign a root password related properties so the container can run. Add these environment properties (_all at once_) and then save the changes. Saving will trigger the container run and it'll create the data in the volume described in point 2. so add the properties before saving:
MYSQL_ROOT_HOST = %
MYSQL_ROOT_PASSWORD =

Note that **MYSQL_ROOT_PASSWORD is just one of the 3 required options you are given to start this container.
To check if you did the previous part properly you can use the command prompt as @lucile-sticky describes in their answer. I'm taking part of their answer directly.
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:
- From a terminal, connect you to your MySQL running container
docker exec -it your_container_name_or_id bash
- In your container, connect you to the MySQL database
mysql -u your_user -pIt will ask you your password, you have to write it and press enter.
- In your MySQL database, execute this SQL script to list all existing database users
SELECT host, user FROM mysql.user;...
It has to contain a line with your database user and '%' to works (% means "every IP addresses are allowed"). Example:
| host | user | +------------+------------------+ | % | root | +------------+------------------+
- @lucile-sticky
To connect MySQL Workbench to the Docker container you must use the user and password defined for this example in literal 2. (root) and the port exposed in literal 1.

Test the connection and it should work properly now.
+1
I have a falcon app which uses pony orm for mysql.
I am binding the db using this--
db.bind(provider='mysql', user='shankha', password='shankhaSQL@123', host='127.0.0.1', database='smart_senseV2')
In my Docker file (my_falcon_app:0.1) I have -EXPOSE 8081 CMD ["gunicorn", "--reload", "routes:api", "-b:8081"]My Docker-compose looks like this-
version: "3" services: app: image: my_falcon_app:0.1 links: - my-db ports: - "8081:8081" my-db: image: mysql:5.7 ports: - "3308:3306" environment: MYSQL_ROOT_PASSWORD: password MYSQL_DATABASE: db_1 MYSQL_USER: root MYSQL_PASSWORD: password # MYSQL_ROOT_HOST: '127.0.0.1' volumes: - ./SQP_SCRIPTS:/docker-entrypoint-initdb.d - ./DB_DATA:/var/lib/mysql:rw - ./DB_config/mysqld.conf:/etc/mysql/mysql.conf.d/mysqld.cnfconfig_file--
[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock bind-address = 0.0.0.0the container for DB gets created but the app crashes every time,
error message:
app_1 | pony.orm.dbapiprovider.OperationalError: (2003, "Can't connect to MySQL server on '127.0.0.1' ([Errno 111] Connection refused)")
app_ exited with code 3HELP!
you can try
db.bind(provider='mysql', user='shankha', password='shankhaSQL@123', host='0.0.0.0', database='smart_senseV2')
I replaced 127.0.0.1 whit 0.0.0.0
It should work well
@mukhtiarahmed this did not work for me. However, from compose file, I was passing
environment:
DB_HOST: my-db
and in code
import os
db.bind(provider='mysql', user='shankha', password='shankhaSQL@123', host=os.environ['DB_HOST'], database='smart_senseV2')
it was working well
NOW agin the same problem came.
is not there any permanent solution for this??
I've got the connection problem on mysql 5.7, 5.7.26 and 5.7.16 on the actual Docker / WSL Ubuntu / WinX Prof
ERROR 1130 (HY000): Host '172.17.0.1' is not allowed to connect to this MySQL server
To change the Localhost "%" :
GRANT ALL PRIVILEGES ON . TO 'root'@'%' IDENTIFIED BY 'root';
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'@'%';
thank you so much
Using docker-compose, I replaced the environment values with references to env variables from .env. Then I shut down the containers, deleted the volume (docker volume ls, docker volume rm ...) and ran docker-compose up.
# docker-compose.yml
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
# .env
MYSQL_ROOT_PASSWORD=...
MYSQL_DATABASE=...
MYSQL_USER=...
MYSQL_PASSWORD=...
I just had this issue with a Lando setup. The comments about volumes led me to just nuke everything locally with docker system prune --all and now it all works again for me (plus I got 23GB freed up).
You cannot just add MYSQL_ROOT_HOST after you discover you cannot connect. This value is apparently only used on initial container creation.
The simplest solution is to delete the existing containers.
If MYSQL_ROOT_HOST is not working for you, like in older versions of the image (5.5, 5.6), you can create a startup script, which updates the host field for the root user:
## docker-compose.yaml
...
volumes:
- ./mysql/:/docker-entrypoint-initdb.d/:ro
## ./mysql/update-root-host.sql
use mysql;
update user set host='%' where user='root' and host='127.0.0.1';
You cannot just add
MYSQL_ROOT_HOSTafter you discover you cannot connect. This value is apparently only used on initial container creation.The simplest solution is to delete the existing containers.
--env "MYSQL_ROOT_HOST=%" is valid when running a container like so:
docker run --detach --name dev_mysql --network dev_net --env="MYSQL_ALLOW_EMPTY_PASSWORD=yes" --env="MYSQL_ROOT_HOST=%" mysql/mysql-server:5.7.26
Your other containers in your dev_net network will be able to connect by either its IP or hostname, dev_mysql in this instance.
You cannot just add
MYSQL_ROOT_HOSTafter you discover you cannot connect. This value is apparently only used on initial container creation.
The simplest solution is to delete the existing containers.
--env "MYSQL_ROOT_HOST=%"is valid when running a container like so:
docker run --detach --name dev_mysql --network dev_net --env="MYSQL_ALLOW_EMPTY_PASSWORD=yes" --env="MYSQL_ROOT_HOST=%" mysql/mysql-server:5.7.26Your other containers in your
dev_netnetwork will be able to connect by either its IP or hostname,dev_mysqlin this instance.
I'm saying that the MYSQL_ROOT_HOST value is used during database initialization, which only occurs on the container's first startup. After the first startup, the database is initialized and the value will never be used again (unless the db data files are deleted manually).
If one discovers they can't connect because of the permissions issue caused by that value missing during startup, they can't just shutdown the container, set the value, then start it back up. The new value will be present in the environment, but the only code looking at that value is the code that executes during 'db initialization', which only happens in the absence of an existing database.
been on this error for days, why aren't the mysql devs doing anything about this?
I was facing the same issue with the mariadb:10.1 image on docker. After deleting my volumes regarding this container, it solved my problem.
I think that something went wrong on the first time I started my container. The entrypoint of this image checks if the data has been initialised. If so, it skips all initialisations. But if something went wrong on the first time, the corrupted configuration will exist in the volume.
So if you are facing the same problem, try to remove the regarding volumes.
I was facing this issue as well (mysql:8.0.16), seemingly at random "SQLSTATE[HY000] [1045] Access denied" would popup. I've tried all suggested solutions before diagnosing the problem: I was running multiple instances of mysql in different composer files and subsequent containers, I stopped / removed one and the issue was solved. My guess is that docker was routing randomly between the two sockets, 1 of them only familiar with the user.
It's simply works to me doing this steps:
in the mysql, inside the container, i put:
GRANT ALL ON . to root @'%' IDENTIFIED BY 'your-password-here';
I solved my problem with creating new user in table.
First check yours users in table:
SELECT user,host FROM mysql.user;
You have to have the host for user root like %.
If it is no % then execute queries:
CREATE USER 'root'@'%' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ONroot.* TO 'root'@'%';
Now you can connect to the server with credentials login = root, pass = root;
yep.....thanks...but I resolve this doing exactly this..thx for this
information...
Em qui., 2 de abr. de 2020 Ã s 07:35, Yaroslav notifications@github.com
escreveu:
I solved my problem with creating new user in table.
First check yours users in table:
SELECT user,host FROM mysql.user;
You have to have the host for user root like %.
If it is no % then execute query:
CREATE USER 'root'@'%' IDENTIFIED BY 'root';
Now you can connect to the server with credentials login = root, pass =
root;—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/docker-library/mysql/issues/275#issuecomment-607763976,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AEFLF25Y3IJIQ2JP2NQBIO3RKRS7BANCNFSM4DENEZ2A
.
docker run --name mysql1 -e MYSQL_ROOT_HOST=% -e MYSQL_ROOT_PASSWORD=your_password -p 3306:3306 -d mysql:latest
worked and without need to create user / set grant.
I tried everything written here but it didn't work.
My problem is a kind of weird.
when I got my containers up I can't connect to my database by any database manager.
I get
mysql | 2020-05-11T15:48:56.348312Z 8 [Warning] [MY-010055] [Server] IP address '172.21.0.1' could not be resolved: Name or service not known
but after I execute my migrations by terminal with the command above, I can access my database by any database manager normally.
$ docker-compose exec php-fpm php artisan migrate
my docker-compose.yml
#MySQL Service
mysql:
image: mysql:8
container_name: mysql
restart: unless-stopped
tty: true
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: database
MYSQL_ROOT_PASSWORD: root
SERVICE_TAGS: dev
SERVICE_NAME: mysql
volumes:
- ./mysql/dbdata:/var/lib/mysql/
- ./mysql/my.cnf:/etc/mysql/my.cnf
networks:
- app-network
and my 'my.cnf'
[mysqld]
general_log = 1
general_log_file = /var/lib/mysql/general.log
secure-file-priv= NULL
#Accept connections from any IP address
bind-address = 0.0.0.0
I'm facing this issue, but in my case instead of using docker-compose, I used simply docker run. Any idea how I can solve?
I fixed my case here
Muchas gracias fue de mucha ayuda!!
In my case It works only when the container is run second time. That's because the mysql service is restarted after first failure. So mysql loads with new config my.cnf with bind-address set to 0.0.0.0. How can this be fixed?
version: '3.3'
services:
mysql:
container_name: affility-mysql
image: mysql:8.0
command: --default-authentication-plugin=mysql_native_password
restart: always
environment:
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_DATABASE: 'wellness_db'
MYSQL_USER: 'someuser'
MYSQL_PASSWORD: 'somepassword'
ports:
- '3306:3306'
expose:
- '3306'
volumes:
- mysqldb-data:/var/lib/mysql
- './mysql/my.cnf:/etc/mysql/my.cnf'
volumes:
affility-datavolume:
In my case It works only when the container is run second time. That's because the mysql service is restarted after first failure. So mysql loads with new config
my.cnfwithbind-addressset to0.0.0.0. How can this be fixed?version: '3.3' services: mysql: container_name: affility-mysql image: mysql:8.0 command: --default-authentication-plugin=mysql_native_password restart: always environment: MYSQL_ROOT_PASSWORD: 'root' MYSQL_DATABASE: 'wellness_db' MYSQL_USER: 'someuser' MYSQL_PASSWORD: 'somepassword' ports: - '3306:3306' expose: - '3306' volumes: - mysqldb-data:/var/lib/mysql - './mysql/my.cnf:/etc/mysql/my.cnf' volumes: affility-datavolume:
Look to my answer above.
Look to my answer above.
@felipemeddeiros
I did that and that's how I created the my.cnf file. I only have the default my.cnf along with bind-address set to 0.0.0.0, and it sometimes work and sometimes doesn't work. I logged into the container and found this..
[mysqld]
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
datadir = /var/lib/mysql
secure-file-priv= NULL
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Custom config should go here
!includedir /etc/mysql/conf.d/
bind-address=0.0.0.0
Which means that my changes are being written there. But it works only when I restart the cotainer, as I'm not restarting the mysql service in the container somehow. Some other times it shows the same old message and my app reports Error: ER_HOST_NOT_PRIVILEGED: Host '172.18.0.3' is not allowed to connect to this MySQL server that I figured because the environment variables are being overlooked while building the container because of the volume declaration.
MYSQL_ROOT_PASSWORD: 'root'
MYSQL_DATABASE: 'wellness_db'
MYSQL_USER: 'someuser'
MYSQL_PASSWORD: 'somepassword'
...and I can't login into the container mysql as root using password root, no database named wellness_db or user someuser.
Database changed
mysql> select host, user from user;
+-----------+------------------+
| host | user |
+-----------+------------------+
| localhost | mysql.infoschema |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+------------------+
4 rows in set (0.00 sec)
Look to my answer above.
@felipemeddeirosI did that and that's how I created the
my.cnffile. I only have the defaultmy.cnfalong withbind-addressset to0.0.0.0, and it sometimes work and sometimes doesn't work. I logged into the container and found this..[mysqld] pid-file = /var/run/mysqld/mysqld.pid socket = /var/run/mysqld/mysqld.sock datadir = /var/lib/mysql secure-file-priv= NULL # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 # Custom config should go here !includedir /etc/mysql/conf.d/ bind-address=0.0.0.0Which means that my changes are being written there. But it works only when I restart the cotainer, as I'm not restarting the mysql service in the container somehow. Some other times it shows the same old message and my app reports
Error: ER_HOST_NOT_PRIVILEGED: Host '172.18.0.3' is not allowed to connect to this MySQL serverthat I figured because theenvironment variablesare being overlooked while building the container because of thevolumedeclaration.MYSQL_ROOT_PASSWORD: 'root' MYSQL_DATABASE: 'wellness_db' MYSQL_USER: 'someuser' MYSQL_PASSWORD: 'somepassword'...and I can't login into the container mysql as
rootusing passwordroot, no database namedwellness_dbor usersomeuser.Database changed mysql> select host, user from user; +-----------+------------------+ | host | user | +-----------+------------------+ | localhost | mysql.infoschema | | localhost | mysql.session | | localhost | mysql.sys | | localhost | root | +-----------+------------------+ 4 rows in set (0.00 sec)
Did you update your mysql version?
@felipemeddeiros
Did you update your mysql version?
Yes, image: mysql:8.0. Actually I have never been using 5.7.
@felipemeddeiros
Did you update your mysql version?
Yes,
image: mysql:8.0. Actually I have never been using 5.7.
As I said you didn't see my answer properly on staskoverflow. Use 8.0.20 version. I was facing the same problem with 8.0 version.
docker run --name mysql1 -e MYSQL_ROOT_HOST=% -e MYSQL_ROOT_PASSWORD=your_password -p 3306:3306 -d mysql:latest
worked and without need to create user / set grant.
This might solve the problem, but won’t it create security risk?
Yes -- that will expose your MySQL instance to your network (which in many cases, especially with VMs on cloud providers, might be the internet at large, depending on your local networking), so you will want to ensure your password is strong, you don't have any additional GRANTs, you keep your instance up-to-date, you firewall access to that port as much as possible from a higher level firewall, etc (standard "exposing my database to the outside world" precautions).
@felipemeddeiros
Did you update your mysql version?
Yes,
image: mysql:8.0. Actually I have never been using 5.7.As I said you didn't see my answer properly on staskoverflow. Use 8.0.20 version. I was facing the same problem with 8.0 version.
Okay, I have set it up with mysql:8.0.20 now but the problem remains. After rebuilding everything often there is no new entry in mysql.user table or any new database. However, that works after couple of retrials!
If anyone struggles with this needs to:
docker-compose.yml doesn't actually change password in existing volume)docker-compose.yml doesn't contain characters that would malform compose format. For example if $ is used it would be interpolated, so for password foo$bar/foo you could get WARNING: The bar variable is not set. Defaulting to a blank string. when starting and actual password would be foo/foo (and then you would get Access denied for user 'your_user'@'172.19.0.1' (using password: YES) when trying to connect with "complete" password).env files are loaded properly. I don't have example right now, but I remember one day I had a problem that file wasn't parsed properly (probably because of = or ") so actual password used in the app wasn't the password defined in .env and in the databaseroot user with password defined in MYSQL_ROOT_PASSWORD, so it wasn't matched. Silly mistake, but it happens.Happy connecting!
MYSQL_ROOT_HOST=172.*.*.*
https://dev.mysql.com/doc/refman/5.7/en/docker-mysql-more-topics.html
The way I fixed this was to create a bash script file and place it inside the 'db' folder (alongside my usual init.sql file that I use to populate my DB). This 'db' folder is the same one I use in my docker-compose.yml for the docker-entrypoint-initdb volume. That means that every script inside the db folder will run automatically while compose is setting up. The bash script contains the following;
echo "Creating new user g..."
mysql -uroot -p"pass" -e "CREATE USER 'g'@'%' IDENTIFIED BY 'pass';"
echo "Granting privileges..."
mysql -uroot -p"pass" -e "GRANT ALL PRIVILEGES ON *.* TO 'g'@'%';"
mysql -uroot -p"pass" -e "FLUSH PRIVILEGES;"
echo "All done."
It essentially logs in as root and creates a user called 'g' on the host '%' - which means the user 'g' works on all hosts, not just localhost. This is the user that my python app will use to connect to the db.
My docker compose yml looks like this;
version: "2"
services:
mysql:
image: mysql:5.7
restart: always
container_name: my_db
environment:
MYSQL_ROOT_PASSWORD: 'pass'
MYSQL_DATABASE: 'db'
ports:
- 33060:3306
volumes:
- ./db:/docker-entrypoint-initdb.d
app:
depends_on:
- mysql
container_name: my_app
build: .
env_file:
- .env
ports:
- "8000:8000"
Hope this helps someone else. Godspeed fellas.
@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 bash2* In your container, connect you to the MySQL database
mysql -u your_user -pIt 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 bash2* In your container, run this command
mysqld --verbose --help | grep bind-addressIt will display address to bind to, for example like this:
--bind-address=name IP address to bind to. bind-address 0.0.0.0The 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 parametersenvironment: MYSQL_ROOT_PASSWORD: 'pass' MYSQL_DATABASE: 'db' MYSQL_USER: 'user' MYSQL_PASSWORD: 'pass'in your
docker-compose.ymlwill not be used, so default user will not be created: you have to create it manually or remove the volume declaration.
Can you show how to change the bind-address parameter?
Can you show how to change the
bind-addressparameter?
If you haven't already changed it (like via command in docker-compose.yml or providing a .cnf file), then you really shouldn't need to change it. The container IP address is usually unknown beforehand and so the container-default of 0.0.0.0 ensures that it will "just work". This is why the Dockerfile comments out bind-address in the upstream-provided config files:
Posting a single command that worked in my case (replace paths to yours):
docker run \
--name=mysql \
--env="MYSQL_ROOT_HOST=%" \
--env="MYSQL_ROOT_USERNAME=root" \
--env="MYSQL_ROOT_PASSWORD=master" \
--mount type=bind,src=/Users/eugene/docker/mysql/etc/my.cnf,dst=/etc/my.cnf \
--mount type=bind,src=/Users/eugene/docker/mysql/var/lib/mysql,dst=/var/lib/mysql \
--detach \
-p 3306:3306 \
mysql/mysql-server:5.7.19
Make sure you have two folders created before running the command above:
/Users/eugene/docker/mysql/etc/my.cnf
/Users/eugene/docker/mysql/var/lib/mysql
Here's the content of /Users/eugene/docker/mysql/etc/my.cnf:
[mysqld]
# IMPORTANT
user=root
# IMPORTANT
bind-address=0.0.0.0
max_allowed_packet=2000M
#ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql_mode=NO_ENGINE_SUBSTITUTION
show_compatibility_56=ON
# logging settings
general-log=0
# actual path: /Users/eugene/docker/mysql/var/lib/mysql/general_log_file.log
general_log_file=/var/lib/mysql/general_log_file.log
slow-query-log=0
# actual path: /Users/eugene/docker/mysql/var/lib/mysql/slow_query_log_file.log
slow_query_log_file=/var/lib/mysql/slow_query_log_file.log
(1) First, check if HOST "%" is present for the USER you created in the container by running the following: -
docker exec -it your_container_name_or_id bash
mysql -u your_user -p
SELECT host, user FROM mysql.user;
For me, this was the output and "%" host was not present
+------------+------------------+
| host | user |
+------------+------------------+
| localhost | root |
| localhost | mysql.sys |
| localhost | root |
+------------+------------------+
To fix this, we need to manually add the "%" for the USER created in the container
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | root |
+-----------+---------------+
(2) You can add it by running the following commands: -
docker exec -it your_container_name_or_id bash
mysql -u your_user -p
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Pa55w0rd' WITH GRANT OPTION;
My passwords were defined in a .env-file. As they contained "special characters" (asterisk, equals-sign, the like), I enclosed them with quotes. The line
MYSQL_PASSWORD: ${DB_PASSWORD}
in the docker-compose.yml resulted in the database being configured with a password _containing_ those quotes.
Defining a password with just alphanumeric characters and not enclosing it solved the issue for me.
I was getting this because I'm using mysql 8 and the mysql library doesn't seem to support the new auth protocol in mysql 8 (caching_sha2_password). I had to change my mysql user over to use mysql_native_password:
ALTER USER 'theUsername'@'%' IDENTIFIED WITH mysql_native_password BY 'thePassword';
FLUSH PRIVILEGES;
for mysql in docker compose add in you mysql container environment
MYSQL_ROOT_HOST: "0.0.0.0"
None of the above can be solved
Most helpful comment
@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
2* In your container, connect you to the MySQL database
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
It will display a table, for example like this:
It has to contain a line with your database user and '%' to works (% means "every IP addresses are allowed"). Example:
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
2* In your container, run this command
It will display address to bind to, for example like this:
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 parametersin your
docker-compose.ymlwill not be used, so default user will not be created: you have to create it manually or remove the volume declaration.