安装配置MySQL手册
运维管安装维护,本文档只记录,详细配置及补充内容
- 安装运维维护版本 mysql 8.0.21
# 安装目录 /usr/local/mysql3386/
rpm -ivh mysql3386-8.0.21-1.el7.centos.x86_64.rpm
- 配置 /usr/local/mysql3386/etc/my.cnf
[client]
port = 3386
socket = /mysql/mysql3386/mysqld.sock
default-character-set=utf8mb4
[mysqld]
character-set-server=utf8mb4
port = 3386
socket = /mysql/mysql3386/mysqld.sock
basedir = /usr/local/mysql3386
datadir = /mysql/mysql3386
back_log = 500
skip-name-resolve
skip-external-locking
concurrent_insert = 2
delay-key-write = ALL
key_buffer_size = 256M
max_allowed_packet = 1024M
table_open_cache = 4096
sort_buffer_size = 2M
net_buffer_length = 8K
read_buffer_size = 2M
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 64M
thread_stack = 512K
log-bin = mysql-bin
log_bin_trust_function_creators = on
binlog_format = row
binlog_row_image=minimal
transaction-isolation = REPEATABLE-READ
sync_binlog=0
relay_log = relay-bin
server-id = 2193386
binlog_cache_size = 8M
max_binlog_size = 1024M
max_relay_log_size = 1024M
binlog_expire_logs_seconds=259200
thread_cache_size = 48
max_connections = 4000
max_connect_errors = 2000
tmp_table_size = 256M
long_query_time = 3
slow_query_log=off
innodb_page_size = 16384
innodb_file_per_table
innodb_buffer_pool_size = 7G
innodb_flush_log_at_trx_commit = 2
innodb_flush_method = O_DIRECT
innodb_log_file_size = 1G
innodb_log_files_in_group = 3
innodb_fast_shutdown = 1
innodb_lock_wait_timeout=86400
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
innodb_io_capacity = 4000
innodb_io_capacity_max = 10000
innodb_open_files = 1000
federated
event_scheduler=1
secure-file-priv = ""
binlog_group_commit_sync_delay=1000
binlog_group_commit_sync_no_delay_count=8
slave-parallel-type=LOGICAL_CLOCK
binlog_transaction_dependency_tracking=WRITESET
binlog_transaction_dependency_history_size=25000
slave-parallel-workers=8
master_info_repository=TABLE
relay_log_info_repository=TABLE
relay_log_recovery=ON
explicit_defaults_for_timestamp=OFF
gtid-mode=ON
enforce-gtid-consistency=ON
slave_pending_jobs_size_max=512M
log_timestamps=SYSTEM
default-time-zone='+8:00'
log_slave_updates=0
open_files_limit=655350
group_concat_max_len=10240000
optimizer_switch='mrr=on,mrr_cost_based=off'
innodb_undo_log_truncate=on
innodb_max_undo_log_size=10737418240
rpl_semi_sync_master_enabled=1
rpl_semi_sync_master_timeout=1000
rpl_semi_sync_slave_enabled=1
rpl_semi_sync_master_wait_point=AFTER_SYNC
default_authentication_plugin=mysql_native_password
[mysqldump]
quick
max_allowed_packet = 16M
[mysql]
no-auto-rehash
[myisamchk]
key_buffer_size = 20M
sort_buffer_size = 20M
read_buffer = 2M
write_buffer = 2M
[mysqlhotcopy]
interactive-timeout
缺省字符集 default-character-set=utf8mb4
数据目录 /mysql/mysql3386;
独立表空间 innodb_file_per_table
身份验证插件 mysql_native_password
- 添加MySQL到PATH变量
PATH=$PATH:/usr/local/mysql3386/bin
- 添加mycli别名方便控制台登录操作
mycli='/usr/local/mysql3386/bin/mysql -usuper -h127.0.0.1 -P3386 -p'