SQLSTATE[HY000] [2002] No such file or directory #5013

Closed
opened 2026-02-05 09:33:44 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @greysmatterweb on GitHub (Oct 18, 2024).

Attempted Debugging

  • I have read the debugging page

Searched GitHub Issues

  • I have searched GitHub for the issue.

Describe the Scenario

I have modified the docker-compose file based on your repo.

Getting an error when loading up with docker-compose. MYSQL error.

compose.yaml file :

services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:latest
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=GB
      - APP_URL=http://127.0.0.1:6875
      - APP_KEY={redacted}
      - DB_HOST=localhost
      - DB_PORT=3306
      - DB_USERNAME=bstack
      - DB_PASSWORD={redacted}
      - DB_DATABASE=bstack
      - QUEUE_CONNECTION= #optional
    volumes:
      - /opt/bookstack/config:/config
    ports:
      - 6875:80
    restart: unless-stopped

When logging on to container I'm not see the MYSQL (or mariaDB) service started. (ps aux)

Using docker version : Docker version 26.1.5+dfsg1, build a72d7cd &
docker-compose version : docker-compose version 1.29.2, build unknown

Have tried changing the DB_Host to 127.0.0.1 - Still fails, same error
I'm not using any .env file/settings
GID/UID match user
Have removed and rebuilt

Can't see anything wrong. Any suggestions?

Exact BookStack Version

lscr.io/linuxserver/bookstack:latest ... latest on dockerhub

Log Content

Details

$ docker logs -f bookstack              
[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    1000
User GID:    1000
───────────────────────────────────────
Linuxserver.io version: v24.10-ls169
Build-date: 2024-10-14T15:22:13+00:00
───────────────────────────────────────
    
Setting resolver to  127.0.0.11
Setting worker_processes to 8
generating self-signed keys in /config/keys, you can replace these with your own keys if required
...+.+...+..+...+.......+++++++++++++++++++++++++++++++++++++++*..+............+++++++++++++++++++++++++++++++++++++++*........+..++++++
...+.....+++++++++++++++++++++++++++++++++++++++*.....+........+...+++++++++++++++++++++++++++++++++++++++*.+.......+........+...+.+...+......+.........+..+..........+.....+...+......+.+...++++++
-----
Waiting for DB to be available

   Illuminate\Database\QueryException 

  SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'bstack' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

  at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829
    825▕                     $this->getName(), $query, $this->prepareBindings($bindings), $e
    826▕                 );
    827▕             }
    828▕ 
  ➜ 829▕             throw new QueryException(
    830▕                 $this->getName(), $query, $this->prepareBindings($bindings), $e
    831▕             );
    832▕         }
    833▕     }

      +39 vendor frames 

  40  /app/www/artisan:35
      Illuminate\Foundation\Console\Kernel::handle()

[custom-init] No custom files found, skipping...

Hosting Environment

on Kali Linux
VERSION_ID="2024.3"
VERSION="2024.3"
6.10.11-amd64

Originally created by @greysmatterweb on GitHub (Oct 18, 2024). ### Attempted Debugging - [X] I have read the debugging page ### Searched GitHub Issues - [X] I have searched GitHub for the issue. ### Describe the Scenario I have modified the docker-compose file based on your repo. Getting an error when loading up with docker-compose. MYSQL error. compose.yaml file : ```yml services: bookstack: image: lscr.io/linuxserver/bookstack:latest container_name: bookstack environment: - PUID=1000 - PGID=1000 - TZ=GB - APP_URL=http://127.0.0.1:6875 - APP_KEY={redacted} - DB_HOST=localhost - DB_PORT=3306 - DB_USERNAME=bstack - DB_PASSWORD={redacted} - DB_DATABASE=bstack - QUEUE_CONNECTION= #optional volumes: - /opt/bookstack/config:/config ports: - 6875:80 restart: unless-stopped ``` When logging on to container I'm not see the MYSQL (or mariaDB) service started. (ps aux) Using docker version : Docker version 26.1.5+dfsg1, build a72d7cd & docker-compose version : docker-compose version 1.29.2, build unknown Have tried changing the DB_Host to 127.0.0.1 - Still fails, same error I'm not using any .env file/settings GID/UID match user Have removed and rebuilt Can't see anything wrong. Any suggestions? ### Exact BookStack Version lscr.io/linuxserver/bookstack:latest ... latest on dockerhub ### Log Content <details><summary>Details</summary> <p> ``` $ docker logs -f bookstack [migrations] started [migrations] 01-nginx-site-confs-default: skipped [migrations] 02-default-location: skipped [migrations] done ─────────────────────────────────────── ██╗ ███████╗██╗ ██████╗ ██║ ██╔════╝██║██╔═══██╗ ██║ ███████╗██║██║ ██║ ██║ ╚════██║██║██║ ██║ ███████╗███████║██║╚██████╔╝ ╚══════╝╚══════╝╚═╝ ╚═════╝ Brought to you by linuxserver.io ─────────────────────────────────────── To support LSIO projects visit: https://www.linuxserver.io/donate/ ─────────────────────────────────────── GID/UID ─────────────────────────────────────── User UID: 1000 User GID: 1000 ─────────────────────────────────────── Linuxserver.io version: v24.10-ls169 Build-date: 2024-10-14T15:22:13+00:00 ─────────────────────────────────────── Setting resolver to 127.0.0.11 Setting worker_processes to 8 generating self-signed keys in /config/keys, you can replace these with your own keys if required ...+.+...+..+...+.......+++++++++++++++++++++++++++++++++++++++*..+............+++++++++++++++++++++++++++++++++++++++*........+..++++++ ...+.....+++++++++++++++++++++++++++++++++++++++*.....+........+...+++++++++++++++++++++++++++++++++++++++*.+.......+........+...+.+...+......+.........+..+..........+.....+...+......+.+...++++++ ----- Waiting for DB to be available Illuminate\Database\QueryException SQLSTATE[HY000] [2002] No such file or directory (Connection: mysql, SQL: select table_name as `name`, (data_length + index_length) as `size`, table_comment as `comment`, engine as `engine`, table_collation as `collation` from information_schema.tables where table_schema = 'bstack' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name) at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ } +39 vendor frames 40 /app/www/artisan:35 Illuminate\Foundation\Console\Kernel::handle() [custom-init] No custom files found, skipping... ``` </p> </details> ### Hosting Environment on Kali Linux VERSION_ID="2024.3" VERSION="2024.3" 6.10.11-amd64
OVERLORD added the 🐕 Support label 2026-02-05 09:33:44 +03:00
Author
Owner

@ssddanbrown commented on GitHub (Oct 19, 2024):

Hi @greysmatterweb,
You'd need to ensure you're also running a database in some way for the BookStack container to connect to.
For example, a complete compose may look like:

---
services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:latest
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - APP_URL=https://bookstack.example.com
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USERNAME=bookstack
      - DB_PASSWORD=<yourdbpass>
      - DB_DATABASE=bookstackapp
    volumes:
      - /path/to/bookstack_app_data:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db

  bookstack_db:
    image: lscr.io/linuxserver/mariadb:latest
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
      - MYSQL_ROOT_PASSWORD=<yourdbpass>
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=<yourdbpass>
    volumes:
      - /path/to/bookstack_db_data:/config
    restart: unless-stopped
@ssddanbrown commented on GitHub (Oct 19, 2024): Hi @greysmatterweb, You'd need to ensure you're also running a database in some way for the BookStack container to connect to. For example, a complete compose may look like: ```yml --- services: bookstack: image: lscr.io/linuxserver/bookstack:latest container_name: bookstack environment: - PUID=1000 - PGID=1000 - TZ=Europe/London - APP_URL=https://bookstack.example.com - DB_HOST=bookstack_db - DB_PORT=3306 - DB_USERNAME=bookstack - DB_PASSWORD=<yourdbpass> - DB_DATABASE=bookstackapp volumes: - /path/to/bookstack_app_data:/config ports: - 6875:80 restart: unless-stopped depends_on: - bookstack_db bookstack_db: image: lscr.io/linuxserver/mariadb:latest container_name: bookstack_db environment: - PUID=1000 - PGID=1000 - TZ=Europe/London - MYSQL_ROOT_PASSWORD=<yourdbpass> - MYSQL_DATABASE=bookstackapp - MYSQL_USER=bookstack - MYSQL_PASSWORD=<yourdbpass> volumes: - /path/to/bookstack_db_data:/config restart: unless-stopped ```
Author
Owner

@greysmatterweb commented on GitHub (Oct 19, 2024):

Hi

Thanks for you reply. I feel so foolish now. Thought it was running as part of the build You did include this in your instructions. My bad ... lesson learnt .... I need to stop - TLDR

@greysmatterweb commented on GitHub (Oct 19, 2024): Hi Thanks for you reply. I feel so foolish now. Thought it was running as part of the build You did include this in your instructions. My bad ... lesson learnt .... I need to stop - TLDR
Author
Owner

@ssddanbrown commented on GitHub (Oct 19, 2024):

No worries, I see that linuxserver have recently reduced their example compose file to not include the database, so now it's not so obvious.

Since this is solved I'll therefore close this off.

@ssddanbrown commented on GitHub (Oct 19, 2024): No worries, I see that linuxserver have recently reduced their example compose file to not include the database, so now it's not so obvious. Since this is solved I'll therefore close this off.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#5013