Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationEventAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
187
Help us understand the problem. What is going on with this article?

More than 5 years have passed since last update.

@rinkun

mac MySQL ターミナル 自動起動

ターミナルを立ち上げるたびに、

$ mysql.server start

と入力するのがめんどくさいので、自動起動の方法を記す。

MySQLはhomebrewでインストール。

$ brew update
$ brew install mysql

インストールが完了したら、

To have launchd start mysql at login:
  ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
  launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

と表示されるが、こちらは使わずに、launchctlのマネージャーにhomebrew-servicesを使用する。

公式サイトはこちら。
https://github.com/Homebrew/homebrew-services

READMEに従ってインストール。

$ brew tap homebrew/services

MySQLを自動起動にする。

$ brew services start mysql

==> Successfully started `mysql` (label: homebrew.mxcl.mysql)

これだけ。

自動起動を止めたい時は、

$ brew services stop mysql

Stopping `mysql`... (might take a while)
==> Successfully stopped `mysql` (label: homebrew.mxcl.mysql)

一覧を取得したい。

$ brew services list

Name       Status  User   Plist
mysql      started ------ /Users/------/Library/LaunchAgents/homebrew.mxcl.mysql.plist
postgresql started ------ /Users/------/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

以上。

187
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
187
Help us understand the problem. What is going on with this article?