- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 MAMP 包中包含的 SQL 服务器进行一些工作。我想设置我的计算机,以便 SQL 服务器在我启动时自动启动。有谁知道实现这一目标的最简单方法?
非常感谢,
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 server。完美的。如果它可能起作用,我也尝试将其放入 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>
这也没有用。此外,奇怪的是,它似乎没有在控制台应用程序中产生任何类型的消息。
我还是卡住了。有人有什么想法吗?
最佳答案
在 mac 中打开 Textedit 或纯文本编辑器,将其粘贴到其中
对于 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.plistsudo chown root:wheel info.mamp.start.mysql.plist
完成。重启你的 Mac
引用:http://stringfoo.com/2008/08/25/tutorial-launching-mamp-silently-on-startup/
关于mysql - 如何在系统启动时自动启动 MAMP sql server,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7326713/
我是一名优秀的程序员,十分优秀!