如何在系统启动时自动启动MAMP sql server
我正在使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 mac 中打开 Textedit 或纯文本编辑器,将其粘贴到其中
For Apache
然后为 mysql 创建另一个文件
请务必将“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
Then create another file for mysql
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/
您可能需要一个 LaunchDaemon 文件。
在/Library/LaunchDaemons/目录下创建一个名为
whatever.plist
的文件,并放置以下内容。注意权限需要是:root:wheel / 644
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
我刚刚想出了解决这个问题的一个可能的方法。事实证明,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.