If you want to set up a Valet Bedrock based WordPress website and you run into this Valet Can’t connect to local MySQL server error. It will block you from generating a Bedrock WordPress website. It is however easy to remedy.
Valet Can’t connect to local MySQL server Error
The error you get will pop up this way on creating a Bedrock WordPress site:
wp valet new woo-guteberg --project=bedrock Don't go anywhere, this should only take a second... Error: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
MariaDB not running
This Valet Can’t connect to local MySQL server Error happens to us all every now and then. Either because we shut down MariaDB or because it did not start properly when we started our Mac.
You probably need to restart MariaDB:
brew services start mariadb
Afterwards you will be able to set up the site without issues:
wp valet new woo-guteberg --project=bedrock Don't go anywhere, this should only take a second... Success: woo-guteberg ready! https://woo-guteberg.dev
It is so easy with Laravel Valet. Love it very much!