I just spent some time pulling out my hair because it wasn't clear that I had to restart MariaDB after rebooting my computer. I had Valet up and running using MariaDB and all was working great, but after rebooting my machine I couldn't get my site to load. It was giving me the following error:
SQLSTATE[HY000] [2002] Connection refused
After a little digging, I round out that I needed to run the following command to bring MariaDB back up:
brew services start mariadb
The following command also works:
mysql.server start
It would be nice if these details could be added to the Valet docs to help others that are trying to get started with Valet.
The last time I did a fresh install of Valet on a new Mac, it installed mariadb and I'm pretty sure it ran brew services start mariadb for me. Perhaps that's changed in the last 3 months.
NOTE: You only have to run brew services start mariadb once, as that also tells it to auto-start on each reboot.
(NOTE: mysql.server start only starts it in the current boot, and doesn't survive a reboot. The brew services start mariadb command survives a reboot.)
ie:
brew info mariadb reports:
To have launchd start mariadb now and restart at login:
brew services start mariadb
Or, if you don't want/need a background service you can just run:
mysql.server start
Hmm...interesting. I'm curious why it didn't auto restart for me.
Hmmm ... my memory was wrong: I just checked and I had installed mariadb before installing Valet. Found these entries (amongst others), in this order in my bash history:
brew install mariadb
brew services start mariadb
composer global require laravel/valet
valet install
So, yes, 馃憤 I agree, adding brew services start mariadb to the docs might be a good idea; granted, brew does tell you to do that at the end of installing mariadb.
This is now mentioned in the docs.
https://laravel.com/docs/5.3/valet#installation
Most helpful comment
Hmmm ... my memory was wrong: I just checked and I had installed mariadb before installing Valet. Found these entries (amongst others), in this order in my bash history:
So, yes, 馃憤 I agree, adding
brew services start mariadbto the docs might be a good idea; granted, brew does tell you to do that at the end of installing mariadb.