當前位置:
首頁 > 知識 > MySQL-默認配置文件

MySQL-默認配置文件

簡述

MySQL自帶了一些默認配置參數,在沒有配置文件的情況下就會使用這些配置參數。

配置文件讀取路徑

通過幫助可以看到配置文件的載入順序

/data/apps/mysql/bin/mysqld --verbose --help

...

Default options are read from the following files in the given order:

/etc/my.cnf /etc/mysql/my.cnf /etc/my.cnf/my.cnf ~/.my.cnf

...

程序是按照這個順序去查找配置文件

查看配置參數

/data/apps/mysql/bin/mysqld --print-defaults

/data/apps/mysql/bin/mysqld would have been started with the following arguments:

--basedir=/data/apps/mysql --datadir=/data/data/mysql/data --port=3306 --socket=/data/data/mysql/data/mysql.sock --pid-file=/data/data/mysql/data/mysql.pid --explicit_defaults_for_timestamp --skip_name_resolve --skip_external_locking --key_buffer_size=1M --table_open_cache=8192 --sort_buffer_size=2M --join_buffer_size=1M --read_buffer_size=2M --read_rnd_buffer_size=2M --binlog_cache_size=1M --myisam_sort_buffer_size=1M --bulk_insert_buffer_size=1M --thread_cache_size=512 --query_cache_type=0 --query_cache_size=0 --max_allowed_packet=256M --tmp_table_size=64M --max_heap_table_size=64M --table_open_cache_instances=32 --metadata_locks_hash_instances=32 --innodb_purge_threads=4 --innodb_old_blocks_pct=70 --innodb_old_blocks_time=500 --character-set-server=utf8 --collation-server=utf8_general_ci --lower_case_table_names=1 --wait_timeout=3600 --interactive_timeout=3600 --max_connections=3000 --back_log=2000 --max_connect_errors=200000 --slow_query_log=1 --slow_query_log_file=/data/data/mysql/datas/slowquery.log --long_query_time=1 --slow_launch_time=1 --server-id=8888 --log_bin=/data/data/mysql/datas/mysql-bin --log_bin_index=/data/data/mysql/datas/mysql-bin.index --max_binlog_size=1G --relay-log=/data/data/mysql/datas/relay-bin --binlog_format=row --slave_skip_errors=all --expire_logs_days=7 --relay_log_recovery=1 --slave_allow_batching=1 --binlog_rows_query_log_events=1 --master_info_repository=TABLE --relay_log_info_repository=TABLE --innodb_buffer_pool_size=2G --innodb_buffer_pool_instances=10 --innodb_data_file_path=ibdata1:512M:autoextend --innodb_log_group_home_dir=/data/data/mysql/datas --innodb_log_files_in_group=3 --innodb_log_file_size=1G --innodb_log_buffer_size=32M --innodb_flush_log_at_trx_commit=2 --innodb_lock_wait_timeout=30 --innodb_thread_concurrency=0 --innodb_file_per_table=1 --innodb_io_capacity=10000 --innodb_io_capacity_max=20000 --innodb_read_io_threads=12 --innodb_write_io_threads=12 --innodb_flush_method=O_DIRECT --innodb_file_format=Barracuda --innodb_file_format_max=Barracuda --innodb_doublewrite=0 --transaction_isolation=READ-COMMITTED --thread_handling=pool-of-threads --extra_port=13066 --thread_pool_oversubscribe=10 --thread_pool_stall_limit=10 --innodb_buffer_pool_load_at_startup=1 --innodb_buffer_pool_dump_at_shutdown=1 --max_prepared_stmt_count=200000 --expand_fast_index_creation=1

主要幾個配置參數

[client]

port = 3306

socket = /data/data/mysql/data/mysql.sock

[mysqld]

basedir=/data/apps/mysql

datadir=/data/data/mysql/data

port = 3306

socket = /data/data/mysql/data/mysql.sock

pid-file = /data/data/mysql/data/mysql.pid

其他參數可以根據實際情況進行調優配置

喜歡這篇文章嗎?立刻分享出去讓更多人知道吧!

本站內容充實豐富,博大精深,小編精選每日熱門資訊,隨時更新,點擊「搶先收到最新資訊」瀏覽吧!


請您繼續閱讀更多來自 linux運維菜 的精彩文章:

TAG:linux運維菜 |