mac mysql 配置文件

来源:2-7 MySQL配置文件(重要参数)

Umud

2020-05-23 08:33:58

我看了你们的回答:mac下mysql没有配置文件。

如果我想修改mac的mysql的一些配置,如何修改

写回答

1回答

时间,

2020-05-23

同学,你好。mac中没有my.cnf 文件,如果同学想对mysql进行配置,可以进行如下操作:

1、进入到 /etc文件夹下,输入cd /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后,配置文件就可以生效了

如果我的回答解决了您的疑惑,请采纳!祝学习愉快~~~~~

0

0 学习 · 2669 问题

查看课程