Open alecisec opened 2 years ago
👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.
It appears that changing the username made the error change but the app still fails to auth to the db
Error becomes:
D'oh! Looks like we can't connect to your database. Please update your database settings in your .env file. Your database says: SQLSTATE[HY000] [1045] Access denied for user 'snipeituser'@'172.31.0.3' (using password: YES) (SQL: select 2 + 2)
When changing ONLY the username, also again auth from command line inside the container works fine
Debug logs show the following:
SQLSTATE[HY000] [1044] Access denied for user 'snipeit'@'%' to database '${MYSQL_DATABASE}' (SQL: select * from information_schema.tables where table_schema = ${MYSQL_DATABASE} and table_name = migrations and table_type = 'BASE TABLE') at vendor/laravel/framework/src/Illuminate/Database/Connection.php:712 708▕ // If an exception occurs when attempting to run a query, we'll format the error 709▕ // message to include the bindings with SQL, which will make this exception a 710▕ // lot more helpful to the developer instead of just the database's errors. 711▕ catch (Exception $e) { ➜ 712▕ throw new QueryException( 713▕ $query, $this->prepareBindings($bindings), $e 714▕ ); 715▕ } 716▕ } +33 vendor frames 34 artisan:35
I think this is because your docker-compose file isn't creating a database in the MariaDB server. Try adding this to your environment variables for your mariadb container:
Debug mode
Describe the bug
Docker containers fail mysql pre-flight check for reasons unknown
Pre-Flight check shows:
D'oh! Looks like we can't connect to your database. Please update your database settings in your .env file. Your database says: SQLSTATE[HY000] [1044] Access denied for user 'snipeit'@'%' to database 'snipeit' (SQL: select 2 + 2)
The following docker-compose.yml was used in testing
version: '2'
services: snipeit: image: snipe/snipe-it:latest environment:
The .env file correctly references this environment variable so it appears the problem lies elsewhere
Reproduction steps
Expected behavior
.env file should be read and then the environment variable checked and used to test db connection
Snipe-IT Version
Any (tested several)
Operating System
Docker
Web Server
Docker
PHP Version
Docker
Additional context
Note that the container can connect fine using command: mysql -h mariadb -u snipeit -p