Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Access denied for user 'database_username'@'bookstack.bookstack_default' #238

Closed
1 task done
synergy1990 opened this issue Oct 26, 2024 · 3 comments
Closed
1 task done

Comments

@synergy1990
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Access denied for user 'database_username'@'bookstack.bookstack_default'
I guess there is something wrong in the init script and especially with the connection to the database.
It might work, when everything was setup correctly with a previous version already and it's just the container being updated, but it definitely fails on an initial setup.

It fails with most recent image:
lscr.io/linuxserver/bookstack:latest
But WORKS with this one:
lscr.io/linuxserver/bookstack:24.10.20241009

Expected Behavior

It should rather work - as it did in the image:
lscr.io/linuxserver/bookstack:24.10.20241009

Also I dislike that the API_KEY-creation is not part of the init-script anymore!

Steps To Reproduce

I completely removed the stack (as it is called in Portainer), the containers, the volumes and did a system prune -a.
It works for the 20241009-image. It always fails with the current one.

Environment

- OS: Ubuntu Server 24.04.01 LTS
- How docker service was installed:
for pkg in docker.io docker-doc docker-compose docker-compose-v2 podman-docker containerd runc; do sudo apt-get remove $pkg; done && \
sudo apt-get update && \
sudo apt-get install ca-certificates curl -y  && \
sudo install -m 0755 -d /etc/apt/keyrings && \
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
sudo chmod a+r /etc/apt/keyrings/docker.asc && \
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
  $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
  sudo tee /etc/apt/sources.list.d/docker.list > /dev/null && \
sudo apt-get update && \
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y && \
sudo usermod -aG docker $USER

CPU architecture

x86-64

Docker creation

services:
  bookstack:
    image: lscr.io/linuxserver/bookstack:latest
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - APP_URL=http://192.168.144.31:6875
      - APP_KEY=WsuTl38ldEY2B14c8FL5hhWlu1v35mTwIXr5Oz+Zitc=
      - DB_HOST=bookstack_db
      - DB_PORT=3306
      - DB_USER=bookstack
      - DB_PASS=mybookstack
      - DB_DATABASE=bookstackapp
    volumes:
      - bookstack:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db

  bookstack_db:
    image: lscr.io/linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - MYSQL_ROOT_PASSWORD=mybookstackrootpw
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=mybookstack
    volumes:
      - bookstackdb:/config
    restart: unless-stopped

volumes:
  bookstack:
  bookstackdb:


Afterwards I run `docker run -it --rm --entrypoint /bin/bash lscr.io/linuxserver/bookstack:latest appkey` and pasted the output to the environmental variable API_KEY= and restarted the container.

Container logs

[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-ls170
Build-date: 2024-10-21T18:29:24+00:00
───────────────────────────────────────
    
using keys found in /config/keys
Waiting for DB to be available
   Illuminate\Database\QueryException 
  SQLSTATE[HY000] [1045] Access denied for user 'database_username'@'bookstack.bookstack_default' (using password: YES) (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 = 'bookstackapp' 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▕     }
      +36 vendor frames 
  37  /app/www/artisan:35
      Illuminate\Foundation\Console\Kernel::handle()
[custom-init] No custom files found, skipping...
[ls.io-init] done.
Copy link

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

@thespad
Copy link
Member

thespad commented Oct 26, 2024

The app key and database information should already have been present in the .env file in your /config/www directory. By nuking everything you've removed that and will need to ensure it matches the readme as some of the DB envs have been renamed to match the upstream values.

The APP_KEY needs to be copied as-is from what is generated, yours is missing the start and will not load correctly even once you've fixed the DB auth issues.

@synergy1990
Copy link
Author

Holy! I didn't see, these changes.
To clearify it for others: USER and PASS were changed to USERNAME and PASSWORD.

Added the "base64:" to the string - now everything is working (again) as It should!
Thank you so much and have a nice weekend! :)

@thespad thespad closed this as completed Oct 26, 2024
@LinuxServer-CI LinuxServer-CI moved this from Issues to Done in Issue & PR Tracker Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants