Closed ghost closed 3 years ago
There isn't a env variable called DB_PORT, so that will not work.
Add the port in the DB_HOST env variable like DB_HOST=10.1.1.50:3307
You should also not use localhost as the APP_URL, as that is only inside the container and not localhost on your docker host. Also your volume should be changed from /path/to/data
to something specific for you.
Make sure bookstack is in the same network as your SQL server.
I tested it locally using our mariadb container and I can't reproduce your issue.
@tobbenb Thanks for reply.
in my setup bookstack container and MySQL server runs on different machine (but connected to same network)
I have tried what you said. When I use DB_HOST=10.1.1.50:3315
with MySql server Log shows below error.
bookstack | nc: getaddrinfo: Name does not resolve
So Do you mean by having SQL server in same network means same docker network or it can be in same network where ports are exposed.
As you tested with Mariadb do you think that with MySql it do not work?
I have just tried with Mariadb but it have same issue bookstack | nc: getaddrinfo: Name does not resolve
So database should be in the same docker network in order it to work? Or MySQL server can be run on different machine (other then where bookstack docker container runs)? Thanks.
You have to wait a little bit when you start up the container as it checks the availability of the SQL server using port 3306, but will continue after a while. So bookstack | nc: getaddrinfo: Name does not resolve
is expected.
You have still not supplied the container log as asked either.
You need to be able to ping the SQL server from within bookstack container. If you use the same docker network, you can specify the container name as the host, if not, you have to use the host IP. Seeing you are running it on another computer, you need to use the IP.
I have checked I can ping to the MySql server from bookstack container. I have waited as you have said and it proceed further. And I have below issue. user have full writes to database but still error.
With MySql Server 8.0
bookstack | nc: getaddrinfo: Name does not resolve
bookstack | nc: getaddrinfo: Name does not resolve
bookstack |
bookstack | Illuminate\Database\QueryException : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = bookstack and table_name = migrations and table_type = 'BASE TABLE')
bookstack |
bookstack | at /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:669
bookstack | 665| // If an exception occurs when attempting to run a query, we'll format the error
bookstack | 666| // message to include the bindings with SQL, which will make this exception a
bookstack | 667| // lot more helpful to the developer instead of just the database's errors.
bookstack | 668| catch (Exception $e) {
bookstack | > 669| throw new QueryException(
bookstack | 670| $query, $this->prepareBindings($bindings), $e
bookstack | 671| );
bookstack | 672| }
bookstack | 673|
bookstack |
bookstack | Exception trace:
bookstack |
bookstack | 1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client")
bookstack | /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:31
bookstack |
bookstack | 2 PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
bookstack | /var/www/html/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php:27
bookstack |
bookstack | Please use the argument -v to see more details.
bookstack | [cont-init.d] 50-config: exited 0.
bookstack | [cont-init.d] 99-custom-files: executing...
bookstack | [custom-init] no custom files found exiting...
bookstack | [cont-init.d] 99-custom-files: exited 0.
bookstack | [cont-init.d] done.
bookstack | [services.d] starting services
bookstack | [services.d] done.
@tobbenb
I was checking on internet and found article for this bug https://bobcares.com/blog/mysql-the-server-requested-authentication-method-unknown-to-the-client/
The preferred auth plugin for Mysql 8.0+ version is caching_sha2_password.
I hope this helps may be to update dependency library in docker image. Thanks
You have the workaround in the link. From what I read, this is an issue with PHP and it's fixed in 7.4. Once we rebase to alpine 3.13, the PHP version will be bumped to 7.4 and is should work without the MySQL workaround.
Expected Behavior
Bookstack app should connect to use mysql running on 10.1.1.50:3315. (ip and port should be considered which is defined in docker-compose.yml file)
Current Behavior
When Providing DB_PORT environment variable in docker-compose.yml file, is ignored by the image and still tries to connect to default mysql port 3306.
Steps to Reproduce
networks: bookstack-network: external: name: bookstack