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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 12:59:09  来源:igfitidea点击:

Does MySQL included with MAMP not include a config file?

mysqlmamp

提问by Darryl Hein

I can't seem to find the my.cnf or other config file for the MySQL that comes with MAMP. Does it not include one?

我似乎找不到MAMP附带的 MySQL 的 my.cnf 或其他配置文件。不包括一个吗?

回答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 文件。

  1. Stop servers
  2. Create a my.cnffile in /Applications/MAMP/conf/
  3. Add your content in to my.cnf
  4. Save my.cnf
  5. Start servers
  1. 停止服务器
  2. 在里面创建一个my.cnf文件/Applications/MAMP/conf/
  3. 将您的内容添加到 my.cnf
  4. 节省 my.cnf
  5. 启动服务器

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 | lesson the MAMP mysqld binary reports:

调用mysqld --verbose --help | lessMAMP 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.cnfdynamically on MAMP server startup, it's best to use the following steps to add or edit the MySQL configuration:

由于 MAMP 服务器my.cnf在 MAMP 服务器启动时动态生成,因此最好使用以下步骤添加或编辑 MySQL 配置:

  1. Stop MAMP server
  2. Goto Files > Edit Template > MySQL
  3. Make the necessary changes and save
  4. Restart MAMP
  1. 停止 MAMP 服务器
  2. 转到文件 > 编辑模板 > MySQL
  3. 进行必要的更改并保存
  4. 重启 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,只有这对我有用:

  1. Stop servers
  2. Create a my.cnffile in /Applications/MAMP/Library/
  3. Add your content into my.cnflike

    [mysqld] max_allowed_packet = 64M

  4. Save my.cnf

  5. Start servers
  1. 停止服务器
  2. 在里面创建一个my.cnf文件/Applications/MAMP/Library/
  3. 将您的内容添加到my.cnf喜欢中

    [mysqld] max_allowed_packet = 64M

  4. 节省 my.cnf

  5. 启动服务器

Not required to change ownership of file, it should work. Verify by running SHOW VARIABLESin 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