Mysql 5.5.10 - Mac 10.6.x - 自动启动

发布于 2024-10-29 20:34:42 字数 248 浏览 2 评论 0原文

我正在尝试在我的 mac pro 上自动启动 mysql 5.5.10 社区服务器 (gpl)。我读过这个论坛上的几个帖子。我仍然感到困惑,因为这些线程引用了一个文件:

/Library/StartupItems/MySQLCOM

我似乎没有这个文件或文件夹。

有人可以帮忙吗?

顺便说一句,我可以使用 mysqld 启动 mysql...并且工作正常。

提前致谢!

I'm trying to automatically start mysql 5.5.10 community server (gpl) on my mac pro. I've read several threads on this forum. I'm still baffled, because those threads refer to a file:

/Library/StartupItems/MySQLCOM

I don't seem to have this file or folder.

Can someone please help.

btw, I can start mysql using mysqld...and it works fine.

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

嗫嚅 2024-11-05 20:34:42

您实际上必须创建这个文件...最好的方法是使用符号链接:

mkdir /Library/StartupItems/MySQLCOM
cd /Library/StartupItems/MySQLCOM/
ln -s /path/to/installation/mysql/support-files/mysql.server MySQLCOM

但是我不推荐这样做。您应该正确执行此操作并使用 launchd - 这是正确的 OS X 方式:-)

首先在 /Library/LaunchDaemons/com.mysql.mysqld.plist 创建一个 plist >

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>GroupName</key>
    <string>_mysql</string>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld</string>
    <key>ProgramArguments</key>
    <array>
        <string>--user=_mysql</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>Umask</key>
    <integer>7</integer>
    <key>UserName</key>
    <string>_mysql</string>
    <key>WorkingDirectory</key>
    <string>INSTALL_PATH/mysql</string>
</dict>
</plist>

然后调整权限:

sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chgrp wheel /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysqld.plist

现在MySQL应该在启动时启动。要测试一切是否正常,无需重新启动,您可以运行:sudo launchctl load com.mysql.mysqld.plist,然后检查错误日志中的消息。

如果您需要添加特殊参数(如自定义日志、cnf 等),您可以通过将它们指定为 中的 元素来实现ProgramArguments 后面的 > 元素。这些 元素的值应该是与 mysqld 一起使用的标准开关。

You actuall have to create this file... Best way is with a symlink:

mkdir /Library/StartupItems/MySQLCOM
cd /Library/StartupItems/MySQLCOM/
ln -s /path/to/installation/mysql/support-files/mysql.server MySQLCOM

However I wouldnt recommend this. You should do it proper and use launchd instead - this is the proper OS X way :-)

First create a plist at /Library/LaunchDaemons/com.mysql.mysqld.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Disabled</key>
    <false/>
    <key>GroupName</key>
    <string>_mysql</string>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld</string>
    <key>ProgramArguments</key>
    <array>
        <string>--user=_mysql</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>Umask</key>
    <integer>7</integer>
    <key>UserName</key>
    <string>_mysql</string>
    <key>WorkingDirectory</key>
    <string>INSTALL_PATH/mysql</string>
</dict>
</plist>

Then an adjust the permission:

sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chgrp wheel /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo chmod 644 /Library/LaunchDaemons/com.mysql.mysqld.plist

Now MySQL should be launched on startup. To test that everything works without rebooting you can run: sudo launchctl load com.mysql.mysqld.plist then check your error logs for messages.

IF you need to add special args (like custom logs, cnf, etc..) you can do so by specifying them as <string> elements in the <array> element following <key>ProgramArguments</key>. The values of those <string> element should be the standard switches you would use with mysqld.

梦醒灬来后我 2024-11-05 20:34:42

对于较新版本的 OSX 安装 plist 的方式略有变化。

不要简单地在 LaunchDemons 文件夹中创建文件并修改权限,而是在本地文件夹中创建 plist 文件,然后运行:
sudo install com.mysql.mysqld.plist /Library/LaunchDaemons

A slight change to how to install the plist for newer versions of OSX.

Instead of simply creating the file in the LaunchDemons folder and modifying permissions, create the plist file in a local folder and then run:
sudo install com.mysql.mysqld.plist /Library/LaunchDaemons

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文