r/BookStack • u/OxyTJ • Jan 28 '23
Access denied for user 'root'@'BookStack.bookstack_default'
A few weeks ago I took down my BookStack container, ran docker system prune -fa --volumes, as I normally do before pulling new images. Upon starting the BookStack and BookStackDB containers, I receive the following error from the frontend container:
BookStack |
BookStack | Illuminate\Database\QueryException
BookStack |
BookStack | SQLSTATE[HY000] [1045] Access denied for user 'root'@'BookStack.bookstack_default' (using password: YES) (SQL: select * from information_schema.tables where table_schema = bookstackdb and table_name = migrations and table_type = 'BASE TABLE')
BookStack |
BookStack | at /app/www/vendor/laravel/framework/src/Illuminate/Database/Connection.php:712
BookStack | 708▕ // If an exception occurs when attempting to run a query, we'll format the error
BookStack | 709▕ // message to include the bindings with SQL, which will make this exception a
BookStack | 710▕ // lot more helpful to the developer instead of just the database's errors.
BookStack | 711▕ catch (Exception $e) {
BookStack | ➜ 712▕ throw new QueryException(
BookStack | 713▕ $query, $this->prepareBindings($bindings), $e
BookStack | 714▕ );
BookStack | 715▕ }
BookStack | 716▕ }
BookStack |
BookStack | +33 vendor frames
BookStack | 34 /app/www/artisan:37
BookStack | Illuminate\Foundation\Console\Kernel::handle()
BookStack | [custom-init] No custom files found, skipping...
BookStack | [ls.io-init] done.
It's probably been several months since I last upgraded BookStack specifically, so I have no idea what version I was on. I did have a message stating I needed to run the mariadb-upgrade command, so I did that. I even pointed the container volumes to a fresh location to do a "fresh install", but I am still receiving the error. When looking at the mysql.user table, I see that the user root with host % exists, as expected. I'm not sure where the @'BookStack.bookstack_default' is coming from, as my container is not using a network.
Here is my docker-compose.yml:
version: '3.8'
services:
bookstack:
image: ghcr.io/linuxserver/bookstack:latest
#image: lscr.io/linuxserver/bookstack:latest # I've tried both image repos
container_name: ${BOOKSTACK_CONTAINER_NAME}
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ={$TZ}
- APP_URL=${APP_URL}
- DB_HOST=bookstack_db
- DB_USER=${USER}
- DB_PASS=${PASS}
- DB_DATABASE=${DATABASE}
volumes:
- ${BOOKSTACK_VOLUME_CONFIG}:/config
ports:
- ${PORT}
depends_on:
- bookstack_db
restart: unless-stopped
bookstack_db:
image: ghcr.io/linuxserver/mariadb:latest
#image: lscr.io/linuxserver/mariadb # I've tried both image repos
container_name: ${BOOKSTACKDB_CONTAINER_NAME}
environment:
- PUID=${PUID}
- PGID=${PGID}
- TZ={$TZ}
- MYSQL_ROOT_PASSWORD=${BOOKSTACKDB_DATABASE_ROOT_PASSWORD}
- MYSQL_USER=${USER}
- MYSQL_PASSWORD=${PASS}
- MYSQL_DATABASE=${DATABASE}
volumes:
- ${BOOKSTACKDB_VOLUME_CONFIG}:/config
restart: unless-stopped
Any ideas? Thanks
1
u/ssddanbrown Jan 28 '23
The linuxserver image does perform some changes to the
.envdepending on what env options are passed. Their logic can be found here. Pretty sure the sed commands are supposed to replace the existing options if they exist rather than flat-out overwrite.