Mariadb-docker: Host "xxx.xxx.xxx.xxx" is not allowed to connect to this MariaDB server

Created on 4 Mar 2016  路  10Comments  路  Source: MariaDB/mariadb-docker

I get this error on the latest version.

Most helpful comment

This issue is still not resolved. Switched to mysql image. No problems.

All 10 comments

Can you provide us a little more information about how you're running it? I can't seem to reproduce:

$ docker pull mariadb
Using default tag: latest
latest: Pulling from library/mariadb

fdd5d7827f33: Already exists 
a3ed95caeb02: Already exists 
2d9b55a37647: Already exists 
88a4bacbf934: Already exists 
d2f0eb2850d3: Already exists 
e35651814623: Already exists 
12cafcc1e597: Already exists 
b12059a0fd60: Already exists 
9643f0599420: Already exists 
452cf8ba3692: Already exists 
Digest: sha256:de91e4cb58e716a12f0ee204d628ba9c855f217a42f96360181c28beb0e7b075
Status: Image is up to date for mariadb:latest
$ docker run --name some-mariadb -e MYSQL_ROOT_PASSWORD=my-secret-pw -d mariadb
c5b36b0bf92e473b796e6fc2708c0e747ccaa21ab800d769abc6dbcc4e8f957a
$ docker run -it --link some-mariadb:mysql --rm mariadb sh -c 'exec mysql -h"$MYSQL_PORT_3306_TCP_ADDR" -P"$MYSQL_PORT_3306_TCP_PORT" -uroot -p"$MYSQL_ENV_MYSQL_ROOT_PASSWORD"'
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 10.1.12-MariaDB-1~jessie mariadb.org binary distribution

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> SELECT 1;
+---+
| 1 |
+---+
| 1 |
+---+
1 row in set (0.00 sec)

MariaDB [(none)]> 

I use rancher and it likes to setup custom networks for my docker containers which in turn causes the same issue

Error while trying to create admin user: Failed to connect to the database: An exception occured in driver: SQLSTATE[HY000] [1130] Host '10.42.209.230' is not allowed to connect to this MariaDB server

mariadb:
  environment:
    MYSQL_ROOT_PASSWORD: 1234
    MYSQL_DATABASE: owncloud
  labels:
    io.rancher.container.pull_image: always
  tty: true
  image: mariadb
  volumes:
  - /opt/docker/owncloud/db:/var/lib/mysql
owncloud:
  environment:
    VIRTUAL_HOST: owncloud..local
    VIRTUAL_PORT: '8080'
  labels:
    io.rancher.container.pull_image: always
  image: owncloud
  links:
  - mariadb:mariadb
  volumes:
  - /opt/docker/owncloud/data:/var/www/html

I'm experiencing the same problem when using docker-compose -p PROJECT_NAME up, it seems to be related to the custom network which gets created instead of the default one when the project name switch is used.

So I temporarily resolved it using a script that is automatically run when the container starts up.

fix-permissions.sh

#!/bin/bash

mysql -u root -e "grant all on *.* to '$MYSQL_USER'@'%' identified by '${MYSQL_PASSWORD}' with grant option; flush privileges;"

and its use in Dockerfile:

# copy the file into the container
COPY fix-permissions.sh /docker-entrypoint-initdb.d/fix-permissions.sh

# make it executable
RUN chmod +x /docker-entrypoint-initdb.d/fix-permissions.sh

This issue is still not resolved. Switched to mysql image. No problems.

Unable to reproduce. Closing old issue.

I am seeing this on Travis https://travis-ci.org/schmunk42/yii2-giiant/builds/282246176 - works fine locally.

[edit]
Sorry, does not really belong here as I am using a base-image from tutum https://github.com/schmunk42/docker-mariadb-example-databases/blob/master/Dockerfile

I'm experiencing this issue using the OwnCloud docker-compose.yml on the latest version of Docker on OpenSUSE.

Experiencing it on Ubuntu 16

I had the same issue on kubernetes and could fixing it by setting explicitly MYSQL_ROOT_HOST to %.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

foxx picture foxx  路  4Comments

amq picture amq  路  4Comments

citiscaner picture citiscaner  路  3Comments

benkaiser picture benkaiser  路  4Comments

J0WI picture J0WI  路  5Comments