当前位置:网站首页>MySQL配置文件配置
MySQL配置文件配置
2022-08-04 05:35:00 【m0_67401835】
目录
前言
本文主要介绍MySQL配置文件(my.cnf)
测试环境
虚拟机环境:VirtualBox 6.0.24
操作系统:Oracle Linux Server release 6.5 x86_64
MySQL版本:5.7.33
MySQL配置文件在哪里?
确定MySQL的配置文件路径
[[email protected] ~]# mysql --help|grep my.cnf
order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/local/mysql/etc/my.cnf /usr/local/mysql/bin/my.cnf ~/.my.cnf
通过以上命令可以看出,mysql启动是会有一个读取配置文件的优先顺序
[[email protected] ~]# locate my.cnf
/etc/my.cnf
#本环境中mysql的配置文件
my.cnf配置文件说明
默认配置文件查看:
[mysqld]
datadir = /usr/local/mysql/mysql-files
socket = /usr/local/mysql/mysql-files/mysql.sock
user = mysql
symbolic-links=0
[client]
socket = /usr/local/mysql/mysql-files/mysql.sock
[mysqld]、[client],这些中括号代表的是组。
“组”是要为其设置选项的程序或组的名称。在组行之后,任何选项设置行都将应用于命名组,直到选项文件的末尾或给出另一个组行。选项组名不区分大小写。
[mysqld]和[mysql]组分别应用于mysqld服务器和mysql客户端程序。
[client]组允许您指定适用于所有客户端的选项。
还可以指定其他组名,如mysqldump、mysqladmin、mysqld1等等。
修改配置文件
示例如下:
[client]
default-character-set = utf8mb4
port = 3306
socket = /usr/local/mysql/mysql-files/mysql.sock
[mysql]
prompt = "\U \R:\m:\s [d]> "
no_auto_rehash
show-warnings
default-character-set = utf8mb4
socket = /usr/local/mysql/mysql-files/mysql.sock
[mysqld]
user = mysql
port = 3306
symbolic-links = 0
server_id = 56102
basedir = /usr/local/mysql
datadir = /usr/local/mysql/mysql-files
socket = /usr/local/mysql/mysql-files/mysql.sock
pid_file = /usr/local/mysql/mysql-files/rac02.pid
character-set-server = utf8mb4
skip_name_resolve = 1
lock_wait_timeout = 3600
open_files_limit = 65535
back_log = 1024
max_connections = 512
max_connect_errors = 1000000
table_open_cache = 1024
table_definition_cache = 1024
thread_stack = 512K
sort_buffer_size = 4M
join_buffer_size = 4M
read_buffer_size = 8M
read_rnd_buffer_size = 4M
bulk_insert_buffer_size = 64M
thread_cache_size = 768
interactive_timeout = 600
wait_timeout = 600
tmp_table_size = 32M
max_heap_table_size = 32M
log_error = /usr/local/mysql/mysql-files/error.log
log_error_verbosity = 3
slow_query_log = 1
slow_query_log_file = /usr/local/mysql/mysql-files/slow.log
long_query_time = 0.1
log_queries_not_using_indexes = 1
log_throttle_queries_not_using_indexes = 60
min_examined_row_limit = 100
log_slow_admin_statements = 1
log_slow_slave_statements = 1
log_bin = /usr/local/mysql/mysql-files/mysql_binlog
binlog_format = ROW
sync_binlog = 1
binlog_cache_size = 4M
max_binlog_cache_size = 2G
max_binlog_size = 1G
binlog_rows_query_log_events = 1
binlog_checksum = CRC32
gtid_mode = ON
enforce_gtid_consistency = TRUE
key_buffer_size = 32M
myisam_sort_buffer_size = 128M
transaction_isolation = REPEATABLE-READ
innodb_buffer_pool_size = 500M
innodb_buffer_pool_instances = 4
innodb_data_file_path = ibdata1:12M:autoextend
innodb_flush_log_at_trx_commit = 1
innodb_log_buffer_size = 32M
innodb_log_file_size = 200M
innodb_log_files_in_group = 3
innodb_max_undo_log_size = 1G
innodb_io_capacity = 400
innodb_io_capacity_max = 800
innodb_open_files = 65535
innodb_flush_method = O_DIRECT
innodb_lru_scan_depth = 4000
innodb_lock_wait_timeout = 10
innodb_rollback_on_timeout = 1
innodb_print_all_deadlocks = 1
innodb_online_alter_log_max_size = 4G
innodb_status_file = 1
innodb_status_output = 0
innodb_status_output_locks = 1
innodb_sort_buffer_size = 67108864
innodb_adaptive_hash_index = OFF
[mysqldump]
quick
以上配置文件中参数设置仅供参考,仅作为测试使用,生产环境需按需进行调整。
如有错误,请指正,非常感谢!
先自我介绍一下,小编13年上师交大毕业,曾经在小公司待过,去过华为OPPO等大厂,18年进入阿里,直到现在。深知大多数初中级java工程师,想要升技能,往往是需要自己摸索成长或是报班学习,但对于培训机构动则近万元的学费,着实压力不小。自己不成体系的自学效率很低又漫长,而且容易碰到天花板技术停止不前。因此我收集了一份《java开发全套学习资料》送给大家,初衷也很简单,就是希望帮助到想自学又不知道该从何学起的朋友,同时减轻大家的负担。添加下方名片,即可获取全套学习资料哦
边栏推荐
猜你喜欢
QT QOpenGLWidget 全屏导致其他控件显示问题
VMD结合ISSA优化LSSVM功率预测
JVM 快速检测死锁
Microsoft Store 微软应用商店无法连接网络,错误代码:0x80131500
2DCNN, 1DCNN, BP, SVM fault diagnosis and result visualization of matlab
Nacos 原理
狗都能看懂的Self-Attention讲解
HbuilderX 启动微信小程序 无法打开项目
基于时序模式注意力机制(TPA)的长短时记忆(LSTM)网络TPA-LSTM的多变量输入风电功率预测
硬件知识:RTMP和RTSP传统流媒体协议介绍
随机推荐
E-R图总结规范
matlab科研绘图模板,直接奉上源代码!
搭建redis哨兵
Scheduler (Long-term,Short-term, Medium-term Scheduler) & Dispatcher
ES6新语法:symbol,map容器
What is the connection between GRNN, RBF, PNN, KELM?
Memory Management
SegNet——论文笔记
有且仅有的三种处理JSON的方法
天鹰优化的半监督拉普拉斯深度核极限学习机用于分类
matlab封闭曲线拟合 (针对一些列离散点)
数组的一些方法
桌面右键的NVIDIA去除与恢复
ResNet详解:ResNet到底在解决什么问题?
MySQL(4)
对产品设计,架构设计的一点思考
set集合
什么是多态。
Uos统信系统 chrony配置
系统流量预估、架构设计方案