One fine morning last week, I booted my Macbook Pro I had shut down the previous night. The sun was young in the sky, birds chirped and cawed atop freshly-green trees, whose canopies cast their shade on a plethora of beings – from a baby squirrel looking for its nuts, to a driver in a Camry, screaming his off at a jaywalker.
All in all, a great day to code.
…or so I thought.
My Rails app didn’t boot, and this was the error I got:
Mysql2::Error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2 "No such file or directory")
It wasn’t expected, as launchd was supposed to start the database server on boot. “That’s not so bad”, I thought, as I typed the familiar line into zsh:
$ sudo mysql.server start
/usr/local/Cellar/mariadb/10.0.10/bin/my_print_defaults: Can't read dir of '/usr/local/etc/my.cnf.d' (Errcode: 2 "No such file or directory")
Fatal error in defaults handling. Program aborted
That’s just way too many dots, and deserved a CTRL+C.
…and what was that error? I didn’t remember doing anything to blow up my MariaDB installation.
I sighed, rolled up my sleeves, and started debugging.
Actually, the sleeves were already rolled up. I just sighed and started debugging.
My first stop was to call the doctor:
$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!
Nothing. Hmm. Next, I looked for more info about the package:
$ brew info mariadb
mariadb: stable 10.0.13 (bottled)
Conflicts with: mysql, mysql-cluster, mysql-connector-c, percona-server
/usr/local/Cellar/mariadb/10.0.10 (525 files, 125M) *
Poured from bottle
Build: cmake ✘
Build with local infile loading support
Build a universal binary
Compile with the ARCHIVE storage engine enabled
Keep benchmark app when installing
Compile with the BLACKHOLE storage engine enabled
Build the embedded server
Compile with editline wrapper instead of readline
Keep test when installing
A "/etc/my.cnf" from another install may interfere with a Homebrew-built
server starting up correctly.
To reload mariadb after an upgrade:
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
Or, if you don't want/need launchctl, you can just run:
That’s a lot of info, but not helpful to fix the issue at hand.
I knew that there are usually more messages not displayed here, so I ran:
$ brew postinstall mariadb
==> /usr/local/Cellar/mariadb/10.0.13/bin/mysql_install_db --verbose --user=dheeraj --basedir=/usr/local/Cellar/mariadb
READ THIS: https://github.com/Homebrew/homebrew/wiki/troubleshooting
These open issues may also help:
mariadb: missing /usr/local/etc/my.cnf.d, removed by brew prune (https://github.com/Homebrew/homebrew/issues/31760)
Hello there! That’s my exact error! The issue on GitHub is very helpful, it reminded me that I ran brew prune the previous night, which apparently removed a directory MariaDB requires. It also had a simple fix, which I tried:
My takeaway from this whole incident was that, all it took to fix my problem was a strategically placed help message. Homebrew needn’t have cared about it, but the fact they did is what differentiates great software from good software.
User experience is not just about GUIs, flat design and Fitts’s law. It’s about being easy to use, and being helpful to the user when they need it the most.