MAMP 中包含的 MySQL 是否不包含配置文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/678645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does MySQL included with MAMP not include a config file?
提问by Darryl Hein
回答by Dirk Einecke
The MySQL server of MAMP (not PRO) will be started without any my.cnf file. But you can create your own my.cnf file.
MAMP(非 PRO)的 MySQL 服务器将在没有任何 my.cnf 文件的情况下启动。但是您可以创建自己的 my.cnf 文件。
- Stop servers
- Create a
my.cnf
file in/Applications/MAMP/conf/
- Add your content in to
my.cnf
- Save
my.cnf
- Start servers
- 停止服务器
- 在里面创建一个
my.cnf
文件/Applications/MAMP/conf/
- 将您的内容添加到
my.cnf
- 节省
my.cnf
- 启动服务器
You do not have to put a complete configuration in the my.cnf file. You can just add parts of a configuration ... for example:
您不必在 my.cnf 文件中放置完整的配置。您可以只添加配置的一部分......例如:
[mysqld]
max_allowed_packet = 64M
回答by Dmitry Minkovsky
Some standard my.cnf variants can be found at /Applications/MAMP/Library/support-files/
一些标准的 my.cnf 变体可以在 /Applications/MAMP/Library/support-files/ 找到
Invoking mysqld --verbose --help | less
on the MAMP mysqld binary reports:
调用mysqld --verbose --help | less
MAMP mysqld 二进制报告:
Default options are read from the following files in the given order: /etc/my.cnf /etc/mysql/my.cnf /Applications/MAMP/conf/my.cnf ~/.my.cnf
默认选项按给定顺序从以下文件中读取: /etc/my.cnf /etc/mysql/my.cnf /Applications/MAMP/conf/my.cnf ~/.my.cnf
Copy one of the variants in /Applications/MAMP/Library/support-files/ to one of the locations in mysqld's search order above, and you should be good to go after restarting the daemon.
将 /Applications/MAMP/Library/support-files/ 中的变体之一复制到上面 mysqld 搜索顺序中的位置之一,然后在重新启动守护程序后就可以开始使用了。
回答by sreeraj
Since MAMP server generates my.cnf
dynamically on MAMP server startup, it's best to use the following steps to add or edit the MySQL configuration:
由于 MAMP 服务器my.cnf
在 MAMP 服务器启动时动态生成,因此最好使用以下步骤添加或编辑 MySQL 配置:
- Stop MAMP server
- Goto Files > Edit Template > MySQL
- Make the necessary changes and save
- Restart MAMP
- 停止 MAMP 服务器
- 转到文件 > 编辑模板 > MySQL
- 进行必要的更改并保存
- 重启 MAMP
I tried this on MAMP PRO 3.5.
我在 MAMP PRO 3.5 上试过这个。
回答by Mirza Vu
For MAMP 3.5 on Mac El Capitan, only this worked for me:
对于 Mac El Capitan 上的 MAMP 3.5,只有这对我有用:
- Stop servers
- Create a
my.cnf
file in/Applications/MAMP/Library/
Add your content into
my.cnf
like[mysqld] max_allowed_packet = 64M
Save
my.cnf
- Start servers
- 停止服务器
- 在里面创建一个
my.cnf
文件/Applications/MAMP/Library/
将您的内容添加到
my.cnf
喜欢中[mysqld] max_allowed_packet = 64M
节省
my.cnf
- 启动服务器
Not required to change ownership of file, it should work. Verify by running SHOW VARIABLES
in phpmyadmin and look for your changed setting.
不需要更改文件的所有权,它应该可以工作。通过SHOW VARIABLES
在 phpmyadmin 中运行来验证并查找您更改的设置。
回答by L. Cosio
No, it doesn't come with the my.cnf file
不,它没有与 my.cnf 文件一起提供
回答by Eddie B
I found that MAMP PRO will create a my.cnf by default on startup under the MAMP/tmp directory if a ~/my.cnf is not provided ... grepping ps aux you may find the default location under /Applications/MAMP/tmp/my.cnf ...
我发现如果没有提供 ~/my.cnf ,MAMP PRO 将在启动时默认在 MAMP/tmp 目录下创建一个 my.cnf ... grepping ps aux 你可能会在 /Applications/MAMP/tmp 下找到默认位置/my.cnf ...
ps aux | grep mysql
Which provided the following...
其中提供了以下...
root 284 0.0 0.1 2435544 532 ?? Ss 12:00AM 0:00.06 /bin/sh /Applications/MAMP/Library/bin/mysqld_safe
--defaults-file=/Applications/MAMP/tmp/mysql/my.cnf
--port=8889 --socket=/Applications/MAMP/tmp/mysql/mysql.sock
--user=mysql --pid-file=/Applications/MAMP/tmp/mysql/mysql.pid
--log-error=/Applications/MAMP/logs/mysql_error_log.err
--tmpdir=/Applications/MAMP/tmp/mysql/tmpdir
--datadir=/Library/Application Support/appsolute/MAMP PRO/db/mysql