无法让我的mac launchd脚本运行mysql

时间:2015-10-09 15:18:31

标签: mysql macos launchd

所以我在我的mac服务器上安装了mysql,我试图让它通过launchd运行。

我从cmd行启动服务器的命令如下:

mysqld --user=_mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/mysqld.local.err --pid-file=/usr/local/mysql/data/mysqld.local.pid --port=3306 --tmpdir=/tmp

这是我的plist文件:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.oracle.oss.mysql.mysqld</string>
    <key>ProcessType</key>
    <string>Interactive</string>
    <key>Disabled</key>
    <false/>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>SessionCreate</key>
    <true/>
    <key>LaunchOnlyOnce</key>
    <false/>
    <key>UserName</key>
    <string>_mysql</string>
    <key>GroupName</key>
    <string>_mysql</string>
    <key>ExitTimeOut</key>
    <integer>600</integer>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld</string>
    <key>StandardOutPath</key>
    <string>/usr/local/mysql/logs/mysqld.info.log</string>
    <key>StandardErrorPath</key>
    <string>/usr/local/mysql/logs/mysqld.error.logg</string>
    <key>ProgramArguments</key>
        <array>
            <string>/usr/local/mysql/bin/mysqld</string>
            <string>--user=_mysql</string>
            <string>--basedir=/usr/local/mysql</string>
            <string>--datadir=/usr/local/mysql/data</string>
            <string>--plugin-dir=/usr/local/mysql/lib/plugin</string>
            <string>--log-error=/usr/local/mysql/data/mysqld.local.err</string>
            <string>--pid-file=/usr/local/mysql/data/mysqld.local.pid</string>
            <string>--port=3306</string>
            <string>--tmpdir=/tmp</string>
        </array>
    <key>WorkingDirectory</key>
    <string>/usr/local/mysql</string>
</dict>
</plist>

这是我从system.log获得的错误:

Oct  9 11:10:28 PMAs-Mac-Pro com.apple.xpc.launchd[1] (com.oracle.oss.mysql.mysqld[1190]): Service could not initialize: 15A284: xpcproxy + 12644 [1472][19011403-4854-3CCD-9FCF-49C36302EB40]: 0xd
Oct  9 11:10:28 PMAs-Mac-Pro com.apple.xpc.launchd[1] (com.oracle.oss.mysql.mysqld): Service only ran for 0 seconds. Pushing respawn out by 10 seconds.

根据我的理解,这是一个权限错误。我确保/usr/local/mysql拥有_mysql,所以我不确定那里有什么问题。

我还仔细检查了plist文件的权限:

-rw-r--r--  1 root  wheel  1607 Oct  9 11:42 /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist

0 个答案:

没有答案