## ---------------------------------------------------------------------------------------
## [SERVER] MySQL Server Configuration
## ---------------------------------------------------------------------------------------
[mysqld]
## MySQL Server Default Option ------------------------------------------------------------------
server-id = 1
user = mysql
port = 3306
datadir = /wemade/database/data
tmpdir = /tmp
socket = /tmp/mysql.sock
character_set_server = utf8
collation-server = utf8_general_ci
default-storage-engine = InnoDB
skip-name-resolve
skip-external-locking
## MySQL - event-scheduler = ON(true)/OFF(false)
event-scheduler = ON
sysdate-is-now # 함수 sysdate()와 now() 동일하게 처리
back_log = 100 # 동시 접속시 대기시킬 수 있는 커넥션 개수
max_connections = 300
max_connect_errors = 999999
thread_cache_size = 50 # 다쓴 쓰레드를 스레드풀에 저장할 개수
#table_open_cache = 400 # 각 쓰레드별 오픈할 테이블 수
max_allowed_packet = 32M # 요청된 쿼리의 최대 길이의 값
max_heap_table_size = 32M # MEMORY 테이블의 최대 크기
tmp_table_size = 2M # 메모리 내의 임시테이블 크기 (초과 시 디스크에 저장)
# For Per Connection
sort_buffer_size = 512K # 정렬에 필요한 버퍼의 크기 order by 또는 group by 연산 속도와 관련
join_buffer_size = 512K # 조인이 테이블을 풀스캔하기 위해 사용하는 버퍼크기
read_buffer_size = 512K # 테이블 스캔에 필요한 버퍼크기
read_rnd_buffer_size = 512K # 디스크 검색을 피하기 위한 랜덤 읽기 버퍼크기
query_cache_size = 32M #쿼리 결과를 캐싱하기 위해 할당된 메모리 크기
query_cache_limit = 2M # 이 변수 값보다 큰 값은 캐싱이 안됨
group_concat_max_len = 1024 # GROUP_CONCAT() 함수 사용 시 컬럼값 최대 크기
## MySQL Isolation
transaction-isolation = READ-COMMITTED
## InnoDB Plug-in Option -----------------------------------------------------------------------------
innodb_adaptive_flushing = ON
innodb_adaptive_hash_index = 1
innodb_autoinc_lock_mode = 1
innodb_change_buffering = all
innodb_file_format = barracuda
innodb_io_capacity = 600
innodb_max_dirty_pages_pct = 90
innodb_old_blocks_time = 500
innodb_read_io_threads = 6
innodb_stats_on_metadata = 1
innodb_stats_sample_pages = 8
innodb_strict_mode = 0
innodb_use_sys_malloc = 1
innodb_write_io_threads = 6
ignore_builtin_innodb = OFF
## InnoDB Default Option -----------------------------------------------------------------------------
innodb_additional_mem_pool_size = 32M # 데이터 디렉토리 정보와 내부 데이타 구조를 저장하는 메모리 풀의 크기
innodb_autoextend_increment = 100 # 테이블 스페이스 자동 확장 시 크기
innodb_buffer_pool_size = 22G # 데이터와 인덱스를 캐시하기 위해 사용하는 메모리버퍼크기(innodb에서 사용할 메모리 양으로 전체 메모리의 50~80% 정도로 설정)
innodb_buffer_pool_instances = 4
innodb_commit_concurrency = 0 # 동시에 커밋할 수 있는 쓰레드 수. 이 변수가 0(default)이면 동시에 커밋하기 위해 어떤 수 많은 트랜잭션도 허용한다.
innodb_concurrency_tickets = 500
innodb_data_file_path = ibdata1:3G;ibdata2:3G;ibdata3:3G;ibdata4:100M:autoextend
innodb_data_home_dir = /wemade/database/data # innodb 홈디렉토리 경로
innodb_doublewrite = 1 # 이중 쓰기 버퍼 활성 (이 옵션은 데이터 정합성을 마줘주는 중요한 변수라 웬만해서는 끄지 않는 변수)
innodb_sync_spin_loops = 20 # 쓰레드가 지연되기 전에 (suspended) 풀어 주기 위해 Innodb 뮤텍스(mutex)를 기다리는 쓰레드의 대기 시간
innodb_file_per_table = 1 # 테이블 단위로 테이블 스페이스 할당, 활성 시 확장자 .ibd 파일이 생성됨
innodb_flush_log_at_trx_commit = 1
# innodb_flush_log_at_trx_commit 이 0으로 설정되면, 로그 버퍼는 초당 한 번씩 로그 파일이 기록이 되고 디스크 연산에 대한 플러시는 로그 파일에서 실행되지만
# 트랙잭션 실행 시점에는 아무것도 실행되지 않게 된다. 이 값이 1(default)로 설정되면, 로그 버퍼는 각 트랜잭션이 실행될 때마다 로그 파일에 기록되고 로그 파일에서 디스크 연산에
# 대한 플러시가 실행된다. 2로 설정되면 로그 버퍼는 각 실행시점마다 파일로 기록되지만, 디스크 연산에 대한 플러시는 실행되지 않는다. 하지만 로그 파일에 대한 플러시는
# 값이 2일 때에도 초당 한번씩 실행된다. 초당 1회의 플러시는 모든 초당 이루어진다고는 장담할 수가 없는데, 그 이유는 프로세스 스케쥴링 문제 때문이라는 점을 알아두자.
# 이 변수의 디폴트 값은 1이며, 이 값은 ACID와의 호환성을 위해 요구되는 값이다. 여러분은 이 값을 1이외의 값으로 설정해서 보다 좋은 성능을 얻을 수는 있겠지만,
# 크래쉬가 나게 되면 한 순간에 모든 것을 잃어 버릴 수도 있다.
# 만약 이 값을 0으로 설정한다면, 어떠한 mysqld 프로세스 크래시라도, 만일 이 값을 2로 설정한다면, os크래시 또는 전원 불량을 통해서만 마지막 초 순간의 트랜잭션이 지워지게 된다.
# 하지만 innodb의 크래시 복구는 영향을 받지 않으며 따라서 크래시 복구는 변수 값에 상관없이 실행된다. 대대수의 os와 몇몇 디스크들은 디스크에 대한 플러시 연산을 제대로 실행하지 못한다는 점을 알아두자.
innodb_flush_method = O_DIRECT # 더블 버퍼링을 막아줌. (성능을 위해 메모리에서 직접 액세스하도록 한다면 O_DSYNC 를 사용)
innodb_force_recovery = 0 # 크래쉬 복구 모드 설정 ( http://head1ton.tistory.com/entry/InnoDB-%ED%85%8C%EC%9D%B4%EB%B8%94-%EC%86%90%EC%83%81%EA%B9%A8%EC%96%B4%EC%A7%84%EC%8B%9C-%EA%B0%95%EC%A0%9C-%EB%B3%B5%EA%B5%AC )
innodb_lock_wait_timeout = 60 # 롤백이 진행되기 전에 LOCK을 대기하는 시간(초)
innodb_log_buffer_size = 16M # Redo 로그 버퍼크기
innodb_log_file_size = 1G # 로그 파일 사이즈로 버퍼풀 사이즈의 25% 정도로 설정
innodb_log_files_in_group = 2 # 로그 파일 그룹
innodb_log_group_home_dir = /wemade/database/data
#innodb_log_arch_dir = /wemade/database/data # 로그 디렉토리 정보
innodb_max_purge_lag = 0
innodb_support_xa = OFF # 트랜잭션 two-phase commit(분산데이터 기능) 지원, 디스크 플러시 횟수를 줄여 성능향상
innodb_table_locks = 1 # LOCK TABLES 는 autocommit = 0 경우에 innodb로 하여금 내부적으로 테이블을 잠금
innodb_thread_concurrency = 0 # innodb 내에 쓰레드 갯수, 변수 0은 쓰레드 간 동시성 비활성화 (core * 2로 설정?)
innodb_thread_sleep_delay = 1000 # thread가 queue에 들어오기 전에 innodb 쓰레드가 일시 정지(sleep)하는 시간
innodb_fast_shutdown = 0 # 0은 shutdown 전에 full purge와 buffer merge, 1은 내부적 수행(메모리 구조 정리, 인덱스 버퍼정리 작업)을 skip, 2는 log만 flush하고
# shutdown-mysql이 깨지고 커밋되지 않은 트랜잭션은 잃어버림.
## MyISAM Option -----------------------------------------------------------------------------
## Even if you're not using MyISAM tables, you should still set it to 8-64M as it will also be
## used for internal temporary disk tables.
## If you use MYISAM, you can set still key_buffer_size=4GB(max)
key_buffer_size = 32M # index 블록을 위해 사용되는 buffer 크기
bulk_insert_buffer_size = 32M # myisam이 빠른 대량 insert를 하기 위한 size, 쓰레드 당 각각 할당됨
myisam_sort_buffer_size = 1M # repair, index, alter 정렬에 사용되는 메모리
myisam_max_sort_file_size = 1G # repair, alter load 등 index 재생성 시 사용되는 임시 파일 크기
myisam_repair_threads = 1 # 정렬 복구 시 사용될 쓰레드 갯수
myisam_recover # myisam 테이블을 열었을 시 테이블 자동 복구
ft_min_word_len = 3 # 하나의 fulltext 인덱스에 포함되는 단어의 최소 길이 값. 변경 후 repair table tbl_name QUICK 으로 재 구축해야함.
## Logging Option -----------------------------------------------------------------------------
pid-file = /wemade/database/data/mysqld.pid
log-warnings = 1
log-error = /wemade/database/data/mysqld
## "SET GLOBAL general_log = 1" (true)
#general_log = 1
#general_log_file = /wemade/database/data/mysqld
log_slow_admin_statements # DDL쿼리도 슬로우 쿼리에 기록
slow-query-log = 1
long_query_time = 1
slow_query_log_file = /wemade/database/data/slow_query.log
log-output = FILE
### Replication Option ------------------------------------------------------------------------
## Master Server
log-bin = /wemade/database/binlog/mysql-master-bin
binlog_cache_size = 128K
max_binlog_size = 512M
expire_logs_days = 15
log-bin-trust-function-creators = 1
sync_binlog = 1
binlog_format = mixed
binlog-ignore-db = information_schema
binlog-ignore-db = performance_schema
binlog-ignore-db = mysql
binlog-ignore-db = test
## Slave Server
# relay-log = /wemade/database/binlog/relay_log
# relay_log_purge = TRUE
# read_only
## Slave Server = Master Server
## This option tells the slave to log the updates performed by its SQL thread to its own binary log
# log-slave-updates
## ---------------------------------------------------------------------------------------
## [CLIENT] MySQL Common Client Configuration
## ---------------------------------------------------------------------------------------
[client]
socket = /tmp/mysql.sock
port = 3306
## ---------------------------------------------------------------------------------------
## [MYSQL CLIENT] MySQL Command line client(mysql) Configuratin
## ---------------------------------------------------------------------------------------
[mysql]
default-character-set = utf8
no-auto-rehash # 자동 완성 기능 비활성화
show-warnings # 경고 발생시 메세지 자동 출력
prompt=\d\_\R:\m:\\s> # SQL 프롬프트 설정
#pager="less -n -i -F -X -E" # 데이터 출력시 페이징처리
You do NOT need to grant all permissions, this is a bad habit to get into from a security standpoint.
All you need to grant is this (as root or whoever):
GRANT SHUTDOWN ON *.* TO ‘debian-sys-maint’@'localhost’;
GRANT SELECT ON `mysql`.`user` TO ‘debian-sys-maint’@'localhost’;
Because it needs to shutdown/startup, and does a test select from the users table as a sanity check to ensure the root user exists. This select is usually done by /usr/share/mysql/debian-start.inc.sh which is loaded by /etc/mysql/debian-start
[출처] error: 'Access denied for user 'debian-sys-maint'@'localhost' (using password: YES)'|작성자 쭌