Host is not allowed to connect to this MariaDB server error #3906

Closed
opened 2026-02-05 07:49:57 +03:00 by OVERLORD · 1 comment
Owner

Originally created by @damomato on GitHub (Jul 9, 2023).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

Similar error to #4296 where I can not get this working and I'm not sure what I'm doing wrong.

My docker-compose is the following (all 3 passwords are the same and are alphanumerical)

services:
  bookstack:
    image: lscr.io/linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1026
      - PGID=1000
      - APP_URL=https://192.168.1.122:6875
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=password
      - DB_DATABASE=bookstackapp
    volumes:
      - ./config:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db

  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1026
      - PGID=1000
      - TZ=Removed/Removed
      - MYSQL_ROOT_PASSWORD=password
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=password
    volumes:
      - ./configdb:/config
    restart: unless-stopped

In the bookstack container I get the following error in the logs instead of it doing the migration:

SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE') at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760)

If I restart the bookstack container I get a different message

SQLSTATE[HY000] [1130] Host 'bookstack.bookstack_default' is not allowed to connect to this MariaDB server (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE')

In the bookstack_db container I receive the following in the logs
Warning: World-writable config file '/etc/my.cnf.d/custom.cnf' is ignored

In the .env file the database details are the following. So even though I specify DB_USER and DB_PASS it turns into USERNAME and PASSWORD, not sure if that's an issue or not.

DB_HOST='bookstack_db'
DB_PORT='3306'
DB_DATABASE='bookstackapp'
DB_USERNAME='bookstack'
DB_PASSWORD='password'

and in the mysqld custom.cnf file the user is abc instead of bookstack, not sure if thats also an issue.
user = abc

I have tried removing containers, pruning everything and creating containers again but I still have the same error. It looks like a permissions issue with the database but I don't know how to resolve.

Exact BookStack Version

Latest

Log Content

No response

PHP Version

No response

Hosting Environment

Docker on Synology 920+

Originally created by @damomato on GitHub (Jul 9, 2023). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario Similar error to #4296 where I can not get this working and I'm not sure what I'm doing wrong. My docker-compose is the following (all 3 passwords are the same and are alphanumerical) ``` services: bookstack: image: lscr.io/linuxserver/bookstack container_name: bookstack environment: - PUID=1026 - PGID=1000 - APP_URL=https://192.168.1.122:6875 - DB_HOST=bookstack_db - DB_PORT=3306 - DB_USER=bookstack - DB_PASS=password - DB_DATABASE=bookstackapp volumes: - ./config:/config ports: - 6875:80 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb container_name: bookstack_db environment: - PUID=1026 - PGID=1000 - TZ=Removed/Removed - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=password volumes: - ./configdb:/config restart: unless-stopped ``` In the bookstack container I get the following error in the logs instead of it doing the migration: ``` SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE') {"exception":"[object] (Illuminate\\Database\\QueryException(code: 2002): SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE') at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:760) ``` If I restart the bookstack container I get a different message ``` SQLSTATE[HY000] [1130] Host 'bookstack.bookstack_default' is not allowed to connect to this MariaDB server (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE') ``` In the bookstack_db container I receive the following in the logs `Warning: World-writable config file '/etc/my.cnf.d/custom.cnf' is ignored` In the .env file the database details are the following. So even though I specify DB_USER and DB_PASS it turns into USERNAME and PASSWORD, not sure if that's an issue or not. ``` DB_HOST='bookstack_db' DB_PORT='3306' DB_DATABASE='bookstackapp' DB_USERNAME='bookstack' DB_PASSWORD='password' ``` and in the mysqld custom.cnf file the user is abc instead of bookstack, not sure if thats also an issue. `user = abc` I have tried removing containers, pruning everything and creating containers again but I still have the same error. It looks like a permissions issue with the database but I don't know how to resolve. ### Exact BookStack Version Latest ### Log Content _No response_ ### PHP Version _No response_ ### Hosting Environment Docker on Synology 920+
OVERLORD added the 🐕 Support label 2026-02-05 07:49:57 +03:00
Author
Owner

@damomato commented on GitHub (Jul 9, 2023):

Ok so I have this working now. I think it was the bookstart_db container which wasn't working and wasn't starting MariaDB. I just restarted the bookstack_db container a few times and waited a little while and MariaDB finally started. Then I recreated the bookstack container and it managed to connect to the db and start the migration work and now all working.

@damomato commented on GitHub (Jul 9, 2023): Ok so I have this working now. I think it was the bookstart_db container which wasn't working and wasn't starting MariaDB. I just restarted the bookstack_db container a few times and waited a little while and MariaDB finally started. Then I recreated the bookstack container and it managed to connect to the db and start the migration work and now all working.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#3906