Reputation: 309
I have a docker-compose where I pick up two containers, one with mariadb and one with wordpress.
The problem
I receive a connection failure, apparently the user loses and cannot perform authentication.
wp-mysql | 2019-08-09 13:21:16 18 [Warning] Aborted connection 18 to db: > 'unconnected' user: 'unauthenticated' host: '172.31.0.3' (This connection > closed normally without authentication)
Situation
When I go to http: // localhost: 8010 the wordpress service is available, but with an error connecting to the database.
The docker-compose.yml ...
version: '3'
services:
db:
container_name: wp-mysql
image: mariadb
volumes:
- $PWD/data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: 12345678
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
ports:
- "3307:3306"
networks:
- my_net
restart: on-failure
wp:
depends_on:
- db
container_name: wp-web
volumes:
- "$PWD/html:/var/www/html"
image: wordpress
ports:
- "8010:80"
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
networks:
- my_net
networks:
my_net:
Error:
wp-mysql | 2019-08-09 13:21:16 18 [Warning] Aborted connection 18 to db: > 'unconnected' user: 'unauthenticated' host: '172.31.0.3' (This connection > closed normally without authentication)
Where is the configuration error?
Why can't the wordpress container not use the user created in the mariadb container environment?
Upvotes: 9
Views: 11173
Reputation: 46
I changed my volume in my docker-compose.yml
. This was to preserve data while trialing something.
volumes:
- ./data/mysql:/var/lib/mysql
to the following
volumes:
- ./data/mysql1:/var/lib/mysql
For whatever reason I encountered this error after doing this. To fix this error I ran docker-compose down
and then deleted the folder mysql1
. Then reran the docker-compose up
command.
Upvotes: 0
Reputation: 1135
it may due to database files corrupted due to unexpected shutdown, you can delete the database volume
warnning: this action will drop all your database data
you could use docker-compose down -v
to remove the volumes and then execute docker-compose up -d
to bring it up
in your case, you are not using volume to store your database data, you can remove the data and try again
rm -rf $PWD/data
Upvotes: 10
Reputation: 309
Finally solve it.
After going around and helped by the user @JackNavaRow the solution came out.
It was as simple as rebooting the system and deleting the volumes.
Pick up the containers and everything worked ok.
I leave it here in case anyone encounters this problem, that does not give more turns.
Upvotes: 11