Grant Birchmeier
Grant Birchmeier

Reputation: 18484

How do I start MariaDB on boot on Mac OS X?

Just installed MariaDB (with homebrew). Everything looks like it's working, but I can't figure out how to have it automatically startup on boot on my Mac. I can't find any Mac-specific docs for this.

The installation output says:

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

I guess I don't know where the right place is.

Upvotes: 18

Views: 38551

Answers (4)

Sucipto
Sucipto

Reputation: 867

From brew info mariadb

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

Just run brew services start mariadb on terminal.

Upvotes: 22

WalkerAI
WalkerAI

Reputation: 111

If you install MariaDB by Homebrew, you can use this to see how to start your mariadb at login.

brew info mariadb

To have launchd start mariadb at login:

ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents

Then to load mariadb now:

launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist

Or, if you don't want/need launchctl, you can just run:

mysql.server start

Upvotes: 11

Grant Birchmeier
Grant Birchmeier

Reputation: 18484

With help from Calvin's answer (deleted, I guess?), and this page, these are the steps I used to accomplish this:

cp /usr/local/Cellar/mariadb/5.5.30/homebrew.mxcl.mariadb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist

On next boot, MariaDB was up and running.

Upvotes: 10

Seyeong Jeong
Seyeong Jeong

Reputation: 11028

You need to use launchd. See $ man launchd.

Additionally, Nathan wrote a good article on launchd.

Upvotes: 2

Related Questions