After updating to macOS Ventura, everything seemed to be fine with my Laravel Valet (v4.1.2) setup, but after restarting / doing some other thing which screwed everything, I couldn’t connect to the database properly.
I tried everything.
In the end how I fixed it was abandoning MariaDB (& removing all any any traces of it), dumping the my.cnf
file in /opt/homebrew/etc
and install MySQL v8.0.33 via homebrew.
How much of that was really necessary, I’m not sure, but the key step was deleting the my.cnf
file in /opt/homebrew/etc
.
Until then the brew install mysql
would continually fail at the last step on the brew postinstall mysql
step.
(When I tried it ignore this step I would constantly bump into an ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
error).
In case it was relevant, I also completely removed Laravel Valet – valet uninstall force
– and only re-installed it after I was sure MySQL was OK.
I also switched to using PHP v8.0 locally (as that’s what I’m running all my sites on right now anyway) before doing the valet install (including the initial composer install).
EDIT #1: Here’s what the my.cnf
file looked like once it was working again:
# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1
EDIT #2: Found similar solution here https://andy-carter.com/blog/resolving-post-install-issue-with-mariadb-install-via-homebrew