I’m having some trouble with Bookstack. I’m getting this error on a fresh install with docker-compose:
Illuminate\Database\QueryException : SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.shared_default' (using password: NO) (SQL: select * from information_schema.tables where table_schema = bookstackapp and table_name = migrations and table_type = 'BASE TABLE')
at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
665| // If an exception occurs when attempting to run a query, we'll format the error
666| // message to include the bindings with SQL, which will make this exception a
667| // lot more helpful to the developer instead of just the database's errors.
668| catch (Exception $e) {
> 669| throw new QueryException(
670| $query, $this->prepareBindings($bindings), $e
671| );
672| }
673|
Exception trace:
1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.shared_default' (using password: NO)")
/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31
2 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'bookstack'@'bookstack.shared_default' (using password: NO)")
/var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
Please use the argument -v to see more details.
Here’s my docker-compose.yml section for Bookstack:
Looks like bookstack is not using the password when connecting to the database.
Did you also grant the bookstack db user to access from outside localhost?
That would mean assigning a port to the database container and setting the value DB_HOST to the host IP along with the port I had set, right? I did that and it didn’t work.
I can’t login into it as root either. It seems like it didn’t pass my password environment variables into the container correctly. I tried setting the password to just password and it still didn’t work.
I’m sorry I’m very unfamiliar with SQL…
I did the first part in PhpMyAdmin
this…
select user,host from mysql.user where user=‘bookstack’;
Returns this
ERROR `#1054 - La columna ‘‘bookstack’’ en where clause es desconocida
This is logging in without setting the DB
I do the show databases but nothing shows…
root@nginx-rv-proxy ~# mysql -u bookstack -p -P 3307 -h 192.168.100.15
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 377
Server version: 10.3.21-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show databases
→
→ show databases
→
first screen looks fine, you have user bookstack that can login from anywhere.
Your second screenshot looks like you ran it as root though, i need you to login as bookstack and run show databases; what we are looking for is to ensure your bookstack user sees the bookstackapp database under its own account.