关于Mac mysql my.cnf 配置文件方法

使用Mac的小伙伴在安装配置mysql的时候可能会遇到需要配置my.cnf配置文件的情况
1.如果你只是想确认mysql加载的是哪个配置文件那你可以使用以下方法进行确认。

mysql --verbose --help | grep my.cnf

会得到类似以下的几个地址,默认是在/etc/下的my.cnf。
在这里插入图片描述
打开my.cnf 文件:

sudo vim /etc/my.cnf

输入:

# Example MySQL config file for medium systems.  
  #  
  # This is for a system with little memory (32M - 64M) where MySQL plays  
  # an important part, or systems up to 128M where MySQL is used together with  
  # other programs (such as a web server)  
  #  
  # MySQL programs look for option files in a set of  
  # locations which depend on the deployment platform.  
  # You can copy this option file to one of those  
  # locations. For information about these locations, see:  
  # http://dev.mysql.com/doc/mysql/en/option-files.html  
  #  
  # In this file, you can use all long options that a program supports.  
  # If you want to know which options a program supports, run the program  
  # with the "--help" option.  
  # The following options will be passed to all MySQL clients  
  [client]
  default-character-set=utf8
  #password   = your_password  
  port        = 3306  
  socket      = /tmp/mysql.sock   
  # Here follows entries for some specific programs  
  # The MySQL server  
  [mysqld]
  character-set-server
  • 2
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Mac下,MySQL配置文件名为my.cnf。 如果你想找到MacMySQL的安装位置,可以参考这篇博客文章:https://blog.csdn.net/qq_31708763/article/details/104357564。 如果你在Mac下安装MySQL后发现没有my.cnf文件,你可以按照以下步骤进行解决: 1. 首先,进入MySQL的安装目录,检查是否存在my.cnf文件。如果不存在,可以继续下一步。 2. 打开终端,并输入以下命令来手动创建my.cnf文件: ``` sudo vim /etc/my.cnf ``` 3. 输入上述命令后,需要验证用户密码。验证成功后,会进入Vim编辑器。在编辑器中,添加以下两行代码: ``` <span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [MAC 安装MySQL my.cnf配置文件](https://blog.csdn.net/jyongchong/article/details/77862819)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *2* [MacMySQL的my.cnf配置文件在哪](https://blog.csdn.net/qq_31708763/article/details/104357798)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] - *3* [MacMySQL无my.cnf的详细解决步骤](https://blog.csdn.net/qq_26613917/article/details/103581022)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值