I’m trying to use bedrock for first time but I have a problem with connecting to the mysql database. My database connection section in .env file looks like this
The credentials are working. I also tried to use the DATABASE_URL method. I also tried changing localhost to 127.0.0.1 and 127.0.0.1::3306 but it doesnt work either.
The weirdest part is it looks like these values aren’t even used - my mysql log shows this:
Connect Access denied for user ‘’@‘localhost’ (using password: NO)
But the .env file should be processed by the sever, because if I try and remove database section from .env file I get a 500 error saying I’m missing DB_NAME for example in my config file.
Do you have any idea what could be causing this problem?
MariaDB 10.1.45, Apache 2.4.25, Debian 9.12
Could you describe how it doesn’t work? It’s not clear to me here where you’re encountering the inability to log in, or what error it’s generating. Is it during the in-browser WordPress setup process? Or somewhere else? The
.env file is only going to be parsed by PHP requests running through Bedrock/Wordpress.
I dont even get to the installation process. Everything shows the default WordPress database error in the browser: Error Establishing a Database Connection
Maybe some parsing issue with the
Try again with an empty example
This file has been truncated.
# Optionally, you can use a data source name (DSN)
# When using a DSN, you can remove the DB_NAME, DB_USER, DB_PASSWORD, and DB_HOST variables
# Optional variables
# Generate your keys here: https://roots.io/salts.html
Unfortunatelly it doesn’t work even with fresh .env file … I’ve even tried different web-server with different database credentials … Basically what I do is:
Create database, database user and test the credentials
composer create-project roots/bedrock superweb
And here I get this default WP error:
When I go and investigate what credentials it uses to connect the database I find this line in mysql error log: Connect Access denied for user ‘’@‘localhost’ (using password: NO)
If I try and manually create wp-config.php in /web/wp/wp-config.php and fill in the database credentials - it works and it gets me to the wordpress installation.
The output of $dotenv in application.php looks like this - I think those variables shouldn’t be empty …
Any ideas anybody? Tried different enviroments with the same result …
This topic was automatically closed after 42 days. New replies are no longer allowed.
The one and only problem was, that my server had putenv() in disabled_functions in php.ini.