MySQL 5.5 配置檔案設定
在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_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
用以下命令檢視,當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 = 1innodb_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'
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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- MySQL的配置檔案的引數設定MySql
- MySql5.7配置檔案my.cnf設定MySql
- ssh配置檔案安全設定
- MySQL配置檔案my.ini的一般設定MySql
- MySql5.7配置檔案my.ini 設定 my.ini檔案路徑MySql
- MySQL配置檔案MySql
- mysql 配置檔案MySql
- java配置檔案設定絕對路徑Java
- Golang os 包與設定配置檔案路徑Golang
- Linkerd 2.10(Step by Step)—設定服務配置檔案
- 結合maven設定2套配置檔案的方法Maven
- MySQL檔案my.ini配置MySql
- MySQL InnoDB日誌檔案配置MySql
- MySQL 配置檔案位置及命名。MySql
- Mysql 配置檔案 my.iniMySql
- 如何修復MySQL配置檔案?MySql
- [轉]關於Linux安裝mysql預設配置檔案位置LinuxMySql
- 設定grub配置檔案中的螢幕解析度
- MySQL配置檔案my.ini在哪MySql
- mysql的配置檔案my.cnfMySql
- Mysql配置檔案my.ini配置項詳解MySql
- Mysql:mysql多例項建立、配置檔案講解【四】MySql
- 【ASP.NET Core】用配置檔案來設定授權角色ASP.NET
- MySQL 配置檔案 (my.ini) 詳解MySql
- spring 定時重新整理配置檔案Spring
- 設定 Windows Media Player 推薦設定的登錄檔檔案Windows
- Lumen 檔案上傳設定
- iOS SVN忽略檔案設定iOS
- Go 專案配置檔案的定義和讀取Go
- 配置檔案讀取——MySQL 多個連線MySql
- mysql5.7.26的my.cnf配置檔案MySql
- MySQL-5.5.32 配置檔案優化詳解MySql優化
- Archlinux 設定休眠到swap檔案Linux
- 管理(005):密碼檔案設定密碼
- idea檔案頭資訊設定Idea
- Mysql資料庫配置檔案(my.ini)分析MySql資料庫
- HTTPD之二————HTTPD服務詳解————httpd的配置檔案常見設定httpd
- Git配置配置檔案Git
- 設定儲存檔案的目錄