当前位置: 首页 > 工具软件 > cnf-testsuite > 使用案例 >

my.cnf的常规配置

戚宏扬
2023-12-01

Mysql作为时下流行的关系型数据库,越来越受到企业开发者的青睐。但是很多入门的新手对于其配置了解不深,笔者给出常见的my.cnf配置,以供参考~
/etc/my.cnf

[client]
#password       = your_password
port               = 3306
socket          = /data0/data/mysql.sock
default-character-set = utf8mb4

[mysql]  
default-character-set = utf8mb4

[mysqld]  
character-set-client-handshake = FALSE
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
init_connect = 'SET NAMES utf8mb4'

port            = 3306
socket          = /data0/data/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
datadir = /data0/data

[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

总结不周之处还请包涵,大佬们自然是了如指掌 ,希望对新手朋友们有帮助吧。

 类似资料: