MacOSX: autostart mysql on boot

前端 未结 7 868
隐瞒了意图╮
隐瞒了意图╮ 2020-12-13 08:41

I just installed mysql in terminal through homebrew.

Now when I try to connect to mysql it fails, but after I run mysqld it works..

So what I n

相关标签:
7条回答
  • 2020-12-13 09:19

    I have brew install of MYSQL.

    type

    brew info mysql
    

    and follow the instructions given:

    To have launchd start mysql at login:

    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
    
    0 讨论(0)
  • 2020-12-13 09:21

    Followup to Alejandro that couldn't fit in a comment.

    Check which services are user (login) and root (boot) with this:

    $ brew services list
    Name       Status  User   Plist
    chronograf started jacob  /Users/jacob/Library/LaunchAgents/homebrew.mxcl.chronograf.plist
    grafana    started jacob  /Users/jacob/Library/LaunchAgents/homebrew.mxcl.grafana.plist
    influxdb   started root   /Library/LaunchDaemons/homebrew.mxcl.influxdb.plist
    kapacitor  stopped        
    mariadb    started jacob  /Users/jacob/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
    memcached  started jacob  /Users/jacob/Library/LaunchAgents/homebrew.mxcl.memcached.plist
    telegraf   started jacob  /Users/jacob/Library/LaunchAgents/homebrew.mxcl.telegraf.plist
    
    0 讨论(0)
  • 2020-12-13 09:28

    Mipadi's answer failed for me with MySQL 5.6.13 installed with Homebrew on the date of this post. But I checked brew info mysql as he suggested and it gave me a working solution:

    > ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
    
    0 讨论(0)
  • 2020-12-13 09:30

    brew info mysql gives you the instructions for loading MySQL at startup, but here's all you need to do:

    mkdir -p ~/Library/LaunchAgents
    cp `brew --prefix mysql`/*mysql*.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/*mysql*.plist
    
    0 讨论(0)
  • 2020-12-13 09:37
    mkdir -p ~/Library/LaunchAgents
    cp /usr/local/opt/mysql/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/
    launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
    
    0 讨论(0)
  • 2020-12-13 09:37

    You don't need to setup a plist anymore. The latest version of brew (1.3.4) as of Oct 2017, you can only run:

    brew services start <service_name>

    and it will auto start every time you restart your computer. The command brew info gives you this

    To have launchd start mysql now and restart at login: brew services start mysql Or, if you don't want/need a background service you can just run: mysql.server start

    0 讨论(0)
提交回复
热议问题