如何在系统启动时自动启动MAMP sql server

发布于 2024-12-03 06:45:58 字数 2148 浏览 1 评论 0原文

我正在使用 MAMP 包中包含的 SQL 服务器进行一些工作。我想设置我的计算机,以便 SQL Server 在我启动时自动启动。有谁知道最简单的方法来实现这一点?

非常非常感谢,

D。

更新

当我尝试使用下面由 Macmade 建议的 LaunchDaemon 文件时,我收到以下错误:

110906 19:52:05 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql
110906 19:52:05 [Warning] Setting lower_case_table_names=2 because file system for /Applications/MAMP/db/mysql/ is case in$
110906 19:52:05 [Note] Plugin 'FEDERATED' is disabled.
^G/Applications/MAMP/Library/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110906 19:52:05 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110906 19:52:05 InnoDB: The InnoDB memory heap is disabled
110906 19:52:05 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110906 19:52:05 InnoDB: Compressed tables use zlib 1.2.3
110906 19:52:05 InnoDB: Initializing buffer pool, size = 128.0M
110906 19:52:05 InnoDB: Completed initialization of buffer pool
110906 19:52:05  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110906 19:52:05 mysqld_safe mysqld from pid file /Applications/MAMP/db/mysql/Doyuen-Kos-Mac-Pro.local.pid ended

在这不起作用之后,我查看了一些 MAMP 目录,发现了一个名为 startMysql.sh 的脚本。当我从命令行运行它时,它会启动 sql 服务器。完美的。如果它可能起作用,我也尝试将其放入 LaunchDaemon 文件中。

<?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>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>mysql</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Applications/MAMP/bin/start.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

这也行不通。另外,奇怪的是,它似乎没有在控制台应用程序中产生任何类型的消息。

我还是被困住了。有人有什么想法吗?

I'm doing some work with the SQL server included with the MAMP package. I'd like to set up my computer so that the SQL server launches automatically whenever I boot up. Does anyone know the simplest way to make this happen?

Many, many thanks,

D.

UPDATE

When I try using the LaunchDaemon file suggested by Macmade, below, I get the following errors:

110906 19:52:05 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql
110906 19:52:05 [Warning] Setting lower_case_table_names=2 because file system for /Applications/MAMP/db/mysql/ is case in$
110906 19:52:05 [Note] Plugin 'FEDERATED' is disabled.
^G/Applications/MAMP/Library/bin/mysqld: Can't find file: './mysql/plugin.frm' (errno: 13)
110906 19:52:05 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110906 19:52:05 InnoDB: The InnoDB memory heap is disabled
110906 19:52:05 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110906 19:52:05 InnoDB: Compressed tables use zlib 1.2.3
110906 19:52:05 InnoDB: Initializing buffer pool, size = 128.0M
110906 19:52:05 InnoDB: Completed initialization of buffer pool
110906 19:52:05  InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
110906 19:52:05 mysqld_safe mysqld from pid file /Applications/MAMP/db/mysql/Doyuen-Kos-Mac-Pro.local.pid ended

After this didn't work, I looked in some of MAMPs directories and found a script called startMysql.sh. When I run this from the command line, it starts the sql server. Perfect. On the off chance it might work, I tried throwing this into a LaunchDaemon file, too.

<?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>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>mysql</string>
    <key>ProgramArguments</key>
    <array>
        <string>/Applications/MAMP/bin/start.sh</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

This didn't work either. Also, strangely, it didn't seem to produce any message of any sort in the Console app.

I'm still stuck. Anyone have any ideas?

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

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

发布评论

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

评论(3

書生途 2024-12-10 06:45:58

在 mac 中打开 Textedit 或纯文本编辑器,将其粘贴到其中

For Apache

<?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>Label</key>
    <string>info.mamp.start.apache</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/MAMP/Library/bin/apachectl</string>
      <string>start</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

然后为 mysql 创建另一个文件

<?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>Label</key>
    <string>info.mamp.start.mysql</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/MAMP/Library/bin/mysqld_safe</string>
      <string>--port=3306</string>
      <string>--socket=/Applications/MAMP/tmp/mysql/mysql.sock</string>
      <string>--lower_case_table_names=0</string>
      <string>--pid-file=/Applications/MAMP/tmp/mysql/mysql.pid</string>
      <string>--log-error=/Applications/MAMP/logs/mysql_error_log</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>YOUR_USERNAME</string>
  </dict>
</plist>

请务必将“YOUR_USERNAME”替换为您帐户的用户名。

将此文件另存为(或将文件分别到)/Library/LaunchDaemons/info.mamp.start.apache.plist 和 /Library/LaunchDaemons/info.mamp.start.mysql.plist。

保存此文件夹的文件夹是 /Library/LaunchDaemons/

打开终端,输入

cd /Library/LaunchDaemons/
sudo chown root:wheel info.mamp.start.apache.plist
sudo chown root:wheel info.mamp.start.mysql.plist

完成。重新启动 Mac

参考:http://stringfoo.com /2008/08/25/tutorial-launching-mamp-silently-on-startup/

Open Textedit or Plain text editor in mac, Paste this in it

For Apache

<?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>Label</key>
    <string>info.mamp.start.apache</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/MAMP/Library/bin/apachectl</string>
      <string>start</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
  </dict>
</plist>

Then create another file for mysql

<?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>Label</key>
    <string>info.mamp.start.mysql</string>
    <key>ProgramArguments</key>
    <array>
      <string>/Applications/MAMP/Library/bin/mysqld_safe</string>
      <string>--port=3306</string>
      <string>--socket=/Applications/MAMP/tmp/mysql/mysql.sock</string>
      <string>--lower_case_table_names=0</string>
      <string>--pid-file=/Applications/MAMP/tmp/mysql/mysql.pid</string>
      <string>--log-error=/Applications/MAMP/logs/mysql_error_log</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>YOUR_USERNAME</string>
  </dict>
</plist>

Be sure to replace “YOUR_USERNAME” with the username for your account.

Save this file as (or move the file to) /Library/LaunchDaemons/info.mamp.start.apache.plist and /Library/LaunchDaemons/info.mamp.start.mysql.plist, respectively.

Folder to save this is /Library/LaunchDaemons/

Open terminal, type

cd /Library/LaunchDaemons/
sudo chown root:wheel info.mamp.start.apache.plist
sudo chown root:wheel info.mamp.start.mysql.plist

Done. Restart you Mac

Ref: http://stringfoo.com/2008/08/25/tutorial-launching-mamp-silently-on-startup/

匿名。 2024-12-10 06:45:58

您可能需要一个 LaunchDaemon 文件。

在/Library/LaunchDaemons/目录下创建一个名为whatever.plist的文件,并放置以下内容。

注意权限需要是:root:wheel / 644

<?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>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>mysql</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/mysql/bin/mysqld_safe</string>
        <string>--user=_mysql</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>

You may need a LaunchDaemon file.

Create a file named whatever.plist in the /Library/LaunchDaemons/ directory, and placed the following content.

Note that the permissions need to be: root:wheel / 644

<?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>KeepAlive</key>
    <false/>
    <key>Label</key>
    <string>mysql</string>
    <key>ProgramArguments</key>
    <array>
        <string>/path/to/mysql/bin/mysqld_safe</string>
        <string>--user=_mysql</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
</dict>
</plist>
如果没结果 2024-12-10 06:45:58

我刚刚想出了解决这个问题的一个可能的方法。事实证明,MAMP 的付费版本 MAMP Pro 具有简单的一键式功能来配置您的系统在启动时启动 SQL Server。因此,花大约 50 美元购买付费版本是实现这一目标的一种方法。这不是我所希望的解决方案,但它完成了工作。

I just figured out one possible solution to this problem. It turns out that the paid version of MAMP, MAMP Pro, has a simple 1-click feature to configure your system to launch the SQL server on startup. So, shelling out ~$50 USD to buy the paid version is one way to get this working. It's not the kind of solution I was hoping for, but it got the job done.

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