wp cli – wp-cli + valet: “Error establishing a database connection”
I’m running Laravel Valet to get a simple WP local development environment. Strangely at some point wp-cli stops being able to do much and gives me a “Error establishing a database connection” with nearly everything.
mkdir test cd test wp core download wp config --dbname=test-wp --dbuser=root (test the site at test.test in my browser: works great) wp plugin Error: Error establishing a database connection wp core Error: Error establishing a database connection wp db query "SHOW TABLES" (works: lists all the tables) wp-config.php (excerpt) define( 'DB_NAME', 'cc-wp' ); /** MySQL database username */ define( 'DB_USER', 'root' ); /** MySQL database password */ define( 'DB_PASSWORD', '' ); /** MySQL hostname */ define( 'DB_HOST', '127.0.0.1' );
Not sure what else to test here. What’s frustrating is that the site is working, connecting to the database and even wp-cli can connect to the database via
wp db query so what’s going on with this other stuff?