Error with database connection

Hello !

First thanks for your work. I’m new with bedrock and got my first issue.
I’m using a local dev environnement on my mac with php, apache and mysql installed locally (no MAMP or anything else).

So I create my db and fill the .env file with my infos and go an error message :
env file :

Warning: mysqli_real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) in /Users/thibault/Sites/monTestBedrock/web/wp/wp-includes/wp-db.php on line 1626

Access denied for user 'root'@'localhost' (using password: YES)

But I dont understand why… all infos are fine.

When I try to test the connection with " mysql --user=“blabla” --password=“blablabla” testBedrock" , it connects.

So I tried to change DB Settings infos in the application.php file and instead of env I pushed my infos hardly like this : Config::define(‘DB_USER’, “blabla”); and it works, I’m able to install wordpress and no problems I got my admin and all is working.

BUT it’s not really efficient or the normal way to do it and I prefer to use the env of course. if someone could put me on the track to do it :sweat_smile:

I tried to change localhost with : (like here), didn’t change anything.

Thanks in advance.

edit: it works when I set DATABASE_URL=‘mysql://root:blablabla@localhost:80/testBedrock’ instead of DB_USER, DB_HOST etc… :thinking: so I’m thinking that’s DB port whom is the issue.

1 Like

This topic was automatically closed after 42 days. New replies are no longer allowed.