installing and tuning mariadb on osx

Wanted to install MariaDB on OSX. Mostly because I was running one in an Ubuntu VM and it seemed slow. Running a some dozens inserts taking several seconds.

First install homebrew from
The process is to invoke some cryptic looking command line sentence, which downloads a ruby script over the internet and runs that with the ruby interpreter. Had a look at the script and decided just to install as usual (woohoo for security).

After this: “brew install mariadb”. Wish it was so simple. Once it is installed run “mysql.server start” to start it. Seemed to work, huh. But how do I modify the configuration? The internetz seem to point to /etc/my.sql file that defines the config. No such file. Then after some googling, I get the info I should copy a file called my-default.cnf to /etc/my.cnf.

Well, the dir mentioned where this default file should be does not exist. Instead it seems homebrew installs all software to /usr/local/Cellar directory. So MariaDB is installed in /usr/local/Cellar/mariadb/VERSION. And the config files to copy are under this directory in “support-files”. But there is no my-default.cnf. Only “my-small.cnf”, “my-medium.cnf”, “my-large.cnf”, “my-huge.cnf”. And looking into these it seems that they are a bit out of date as the “huge” talks about a server with 2GB of RAM.

So copy one to /etc/my.cnf. But it seems to have no effect.. More googling. There is a command “my_print_defaults –help” that prints in the end (few paragraphs up) the directories where the DB looks for the configurations. This points to “/usr/local/etc/my.cnf”. This file actually exists but is practically empty. Whee. Well, because it is empty the DB ends up using default configurations. Overwriting something seems to actually work. So we can define settings in this file and they get used. Whee. For options we can look at the my-small.cnf etc. files.

Finally, we can restart the server with “mysql.server restart”. Which ended up failing after all my different configuration attemps at one point. “brew uninstall mariadb” did not work either, as after re-install it still failed to restart. The only thing it prints is the informative message “ERROR”. Whooppee. Google to the rescue and the result is the log is in “/usr/local/var/mysql/your_computer_name.local.err”, where the real cause can be found.

Anyway, had to remove the dir /usr/local/var/mysql and then restart it all (or was it reinstall?). Now it works.. Whooppeee.

And when it finally works? It turned out to be as slow as the Ubuntu version so what was the point.. Finally tried to optimize with setting InnoDB transactions to write once a second (not after all commits) and to write all commits in a single transaction. Helped maybe 20-30%. Still way slow, so whatever..?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s