刚刚使用homebrew安装了MariaDB。看起来一切都正常,但我不知道如何让它在我的Mac开机时自动启动。我找不到任何针对Mac的具体文档。
安装输出信息如下:
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
我想我不知道正确的地方在哪里。
从 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
brew services start mariadb
即可。start
还是 restart
都不起作用,而且没有进程显示。唯一可靠的方法是在每次重启后重新安装 brew upgrade mariadb
。如果你遇到了这个问题,会返回 Service mariadb already started, use brew services restart mariadb to restart.
的提示信息。 - frumbertbrew info mariadb
要让launchd在登录时启动mariadb:
ln -sfv /usr/local/opt/mariadb/*.plist ~/Library/LaunchAgents
现在要加载mariadb:
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
或者,如果您不想/需要使用launchctl,您可以直接运行以下命令:
mysql.server start
在Calvin的回答(已删除,我猜是这样?)以及这个页面的帮助下,我采取了以下步骤:
cp /usr/local/Cellar/mariadb/5.5.30/homebrew.mxcl.mariadb.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mariadb.plist
下次启动时,MariaDB已经运行。
mariadb
? - l008com
mysql.server
的内容是什么?它看起来像一个脚本,还是一个 XML plist? - prodigitalson