[MySQL] 2. MySQL 설정 파일 my.cnf


Mac OS 기준으로 MySQL 설정 파일 my.cnf (윈도우는 my.ini 파일)



my.cnf

설정 파일 위치

/usr/local/etc/my.cnf


Finder에서 숨겨진 시스템 폴더를 탐색

Finder에서 단축키 command + shift + G



my.cnf

[mysqld]
# Only allow connections from localhost
# bind-address = 0.0.0.0
# mysqlx-bind-address = 0.0.0.0

datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql

symbolic-links=0

default-character-set=utf8
character-set-server-utf8
collaction-server=utf8_general_ci

skip-locking
key_buffer_size = 256M
max_allowed_packet = 1M
table_open_cache = 256
sort_buffer_size = 1M
read_buffer_size =1M
read_rnd_buffer_size = 4M
myisam_sort_buffer_size = 64M
thread_cache_size = 8
query_cache_size = 16M
query_cache_limit = 32M
thread_concurrency = 4
max_connections = 100 #200

#slow-query-log-file =
long_query_time = 1
server-id    = 1

[mysqldump]
quick
max_allowed_packet = 16M

[mysql]
no-auto-rehash

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

[mysqlhotcopy]
interactive-timeout

innodb_data_home_dir = /var/lib/mysql
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /var/lib/mysql
innodb_buffer_pool_size = 256M
innodb_additional_mem_pool_size = 20M
innodb_log_file_size = 64M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

[myisamchk]
key_buffer_size = 128M
sort_buffer_size = 128M
read_buffer = 2M
write_buffer = 2M

port = 3306



mysql을 재시작

brew services restart mysql

[참고]

  • https://extrememanual.net/10
  • https://m.blog.naver.com/islove8587/221975639299
  • https://otsteam.tistory.com/428