博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MySQL 5.5 配置文件设置
阅读量:2496 次
发布时间:2019-05-11

本文共 3175 字,大约阅读时间需要 10 分钟。

在MySQL数据库中,可以没有配置文件,在这种情况下,MySQL会安装编译时的默认参数设置启动实例
用以下命令查看,当MYSQL数据库实例启动时,它会在哪些位置查找配置文件
[root@localhost test]# mysql --help | grep my.cnf
                      order of preference, my.cnf, $MYSQL_TCP_PORT,
/etc/my.cnf /etc/mysql/my.cnf /usr/etc/my.cnf ~/.my.cnf
MySQL里面有启动参数、系统参数,启动参数通过show variables无法查询到,可以在mysqld的选项中查到
例如关于二进制日志有Startup Options Used with Binary Logging、System Variables Used with Binary Logging两种参数
[root@localhost log]# mysqld --verbose --help > 02.txt
[root@localhost log]# vim 02.txt
..
  --binlog-do-db=name Tells the master it should log updates for the specified
                      database, and exclude all others not explicitly
                      mentioned.
..
[root@localhost log]# vim /etc/my.cnf
..
# log
server-id = 10000
log-bin = /log/binlog/mysql-bin
binlog_format = MIXED
binlog-do-db = test
[root@localhost data]# vim /etc/my.cnf
[client]
port = 3306
socket=/mysql_data/70005/mysql.sock
# Mysql server
[mysqld]
port = 3306
user = mysql
socket=/mysql_data/70005/mysql.sock
pid-file = /mysql_data/70005/mysqld.pid
basedir = /software
datadir = /data
#tmpdir = 
open_files_limit = 10240
max_connections = 500
max_connect_errors = 100000
sql_mode = NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
wait_timeout = 100
# Cache
table_open_cache = 400
thread_cache_size = 300
# Buffer
max_allowed_packet = 256M
max_heap_table_size = 256M
net_buffer_length = 8K
sort_buffer_size = 4M
join_buffer_size = 2M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
#query_cache_size = 32M
# Log
server-id = 1
log-bin = /log/binlog/mysql-bin
sync_binlog = 2
binlog_cache_size = 32M
max_binlog_cache_size = 512M
max_binlog_size = 512M
binlog_format = MIXED
#binlog_cache_use = 100
#binlog_cache_disk_use = 50
log_output = FILE
log_error = /log/err.log
slow_query_log = 1
slow_query_log_file = /log/slow_query.log
long_query_time = 10
log-short-format = 0
log_slow_admin_statements = 0
log_queries_not_using_indexes = 0
#log_throttle_queries_not_using_indexes = 0
log_slow_slave_statements = 0
general_log = 0
general_log_file = /log/general_query.log
# InnoDB
innodb_data_file_path = ibdata1:12M:autoextend:max:100G
#innodb_data_file_path = /ibdata/ibdata1:12M:autoextend:max:100G
innodb_data_home_dir = /ibdata
innodb_file_per_table = 1
innodb_log_group_home_dir = /log/innodb
#innodb_log_file_size = 256M
#innodb_log_files_in_group = 3
innodb_log_buffer_size = 8M
innodb_buffer_pool_size = 100M
# InnoDB undo __ Mysql 5.6 or higher
#innodb_undo_directory = /log/undo
#innodb_undo_tablespaces = 2
#innodb_undo_logs = 200
innodb_fast_shutdown = 1
innodb_flush_log_at_trx_commit = 1
innodb_buffer_pool_instances = 5
# MyISAM
#skip-external-locking
#key_buffer_size = 128M
#myisam_sort_buffer_size = 64M
# Character set
#character_set_server = gbk
#collation_server = gbk_bin
# Federated storage engine
federated
# Transaction
init_connect='SET autocommit=0'
[mysql]
no-auto-rehash
default-character-set = gbk
[mysqldump]
quick
max_allowed_packet = 16M
[myisamchk]
#key_buffer_size = 256M
#sort_buffer_size = 256M
#read_buffer = 2M
#write_buffer = 2M
[mysqlhotcopy]
#interactive-timeout

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26506993/viewspace-2073963/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/26506993/viewspace-2073963/

你可能感兴趣的文章
joplin笔记
查看>>
JNDI+springmvc使用
查看>>
vue+springboot分页交互
查看>>
vue+springboot打包发布
查看>>
XSL 开发总结
查看>>
【NOI 2018】归程(Kruskal重构树)
查看>>
如何开始DDD(完)
查看>>
[svc]gns3模拟器及探讨几个bgp问题
查看>>
Error:fatal: Not a git repository (or any of the parent directories): .git
查看>>
数组各元素出现的次数
查看>>
我的读书清单(持续更新)
查看>>
53.Maximum Subarray
查看>>
xlistview(脚)
查看>>
咖啡豆(JavaBean)•香
查看>>
hdu2457 Trie图+dp
查看>>
杭电2075
查看>>
ASP.NET Core ---日志
查看>>
Android框架式编程之MVP架构
查看>>
UEditor 插入图片大于2M提示文件大小超出范围解决办法
查看>>
测绘软件使用心得
查看>>