Bedrock Valet Can’t connect to local MySQL server Error

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!

Tagged in : Tagged in : ,
Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.