With my site in Local running when I run a WP CLI command like “wp plugin list”, I get “Error establishing a database connection” in the command line. I am able to access the site fine in a browser in this state.
In wp-config.php, I tried changing the
DB_HOST to alternately
127.0.0.1:8889 (originally it was
localhost), but both gave me the “Error establishing a database connection” when trying to access the site in the browser.
- Does this happen for all sites in Local, or just one in particular?
It’s the only site I have in Local, so not sure.
- Are you able to create a new, plain WordPress site in Local and access it in a Browser?
Here’s a screenshot of my local site setup. I had to use a site host of “localhost:10003” to get around some other issue.
Which version of Local is being used?
What Operating System (OS) and OS version is being used?
Mac OS 11.6.5
Attach the Local Log. See this Help Doc for instructions on how to do so:
local-lightning.log (40.0 KB)
Local does a pretty good job of scrubbing private info from the logs and the errors it produces, however there’s always the possibility that something private can come through. Because these are public forums, always review the screenshots you are sharing to make sure there isn’t private info like passwords being displayed.