Mac端的 my.ini在哪急急急!

Mac端的 my.ini在哪急急急!

Mac端的  my.ini在哪急急急!!!! 有Mac版教学就好了,有点·伤https://img1.sycdn.imooc.com//climg/61b2bffb09f7e29209820532.jpg

正在回答 回答被采纳积分+1

登陆购买课程后可参与讨论,去登陆

1回答
好帮手慕小明 2021-12-10 11:39:13

同学您好,

1、Mac中配置文件是my.cnf,不是my.ini,但MySQL安装后默认没有my.cnf 文件,如果想配置该文件可以参考如下内容:

1)在终端输入cd /etc,进入到 /etc文件夹下,然后在 /etc 新建 my.cnf 文件,使用命令:sudo vim my.cnf

2、将如下配置内容写入到文件中

[client]
default-character-set=utf8
#password   = your_password
port        = 3306
socket      = /tmp/mysql.sock
[mysqld]
character-set-server=utf8
init_connect='SET NAMES utf8
port =3306
socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64
sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
character-set-server=utf8
init_connect='SET NAMES utf8'
#skip-networking   
log-bin=mysql-bin
binlog_format=mixed
server-id = 1
# server-id = 2
# The replication master for this slave - required
#master-host = <hostname>
# The username the slave will use for authentication when connecting
# to the master - required
#master-user = <username>
# The password the slave will authenticate with when connecting to
# the master - required
#master-password = <password>
# The port the master is listening on.
# optional - defaults to 3306
#master-port = <port>
# binary logging - not required for slaves, but recommended
#log-bin=mysql-bin
# Uncomment the following if you are using InnoDB tables
#innodb_data_home_dir = /usr/local/mysql/data
#innodb_data_file_path = ibdata1:10M:autoextend
#innodb_log_group_home_dir = /usr/local/mysql/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
#innodb_buffer_pool_size = 16M
#innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
#innodb_log_file_size = 5M
#innodb_log_buffer_size = 8M
#innodb_flush_log_at_trx_commit = 1
#innodb_lock_wait_timeout = 50
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
# Remove the next comment character if you are not familiar with SQL
#safe-updates
default-character-set=utf8
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout

3) 保存my.cnf文件命令:":wq!"

4) 修改my.cnf的文件权限:sudo chmod 664 /etc/my.cnf

5)  重启mysql后,配置文件就可以生效了

祝同学学习愉快~

  • Heijyu #1

    老师你好,我只执行了新建my.cnf的命令,但是我在电脑搜不到my.cnf这个文件也?

    https://img1.sycdn.imooc.com//climg/61bf0069099f4dd011480746.jpg

    https://img1.sycdn.imooc.com//climg/61bf008209ce6de618560852.jpg

    2021-12-19 17:51:00
  • 同学你好,可能是没有成功创建。建议同学在 /etc文件夹下新建 my.cnf 文件,使用命令:sudo vim my.cnf。然后查看 /etc文件夹下是否存在 my.cnf 文件。

    祝学习愉快!

    2021-12-19 18:30:40
  • 没有,试了好多次,etc文件夹也不在mysql那个文件夹中

    2021-12-19 19:36:29
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师