Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Parsing of my.cnf configuration file

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following content mainly brings you my.cnf configuration file analysis, the knowledge mentioned here, which is slightly different from books, is summed up by professional and technical personnel in the process of contact with users, and has a certain value of experience sharing. I hope to bring help to the majority of readers.

[client]

Default-character-set = utf8mb4

[mysql]

# enable tab completion

# auto-rehash

Default-character-set = utf8mb4

[mysqld]

Port=3306

Basedir=/data/server/mysql57/

Datadir=/data/server/mysql57/data/

Socket=/data/server/mysql57/data/mysql.sock

Symbolic-links=0

Log-error=/data/logs/mysql57/mysqld.log

Pid-file=/data/server/mysql57/data/mysqld57.pid

Disable hostname resolution

Skip-name-resolve

Default database engine

Default-storage-engine = InnoDB

Innodb-file-per-table=1innodb_force_recovery = some pits

Group_concat_max_len = 10240sql_mode=expire_logs_days = 7memlock

Character set configuration

Character-set-client-handshake = FALSE

Character-set-server = utf8mb4

Collation-server = utf8mb4_unicode_ci

Init_connect='SET NAMES utf8mb4'### GTID

Server_id = 33075log to ensure the stability of GTID replication, row-level log

Binlog_format = row

Enable the gtid function

Gtid_mode = on

Secure GTID transactions when enforce_gtid_consistency is enabled, MySQL only allows SQL statements that can secure transactions and can be logged to be executed, such as create table. Select and create temporarytable statements, and SQL statements or transactions that update both transactional and non-transactional tables are not allowed to execute

Enforce-gtid-consistency = true# the following two configurations are switched between master and slave, and must be configured if the database is highly available.

Enable the binlog log function

Log_bin = mysql57-bin

Enable updating binlog logs from the library

Log-slave-updates = on

# slave replication process does not start with mysql startup

Skip_slave_start=1### slow query log

Turn on slow query log function

Slow_query_log = recording queries for more than 2 seconds

Long_query_time = queries record queries that do not use indexes

Log_queries_not_using_indexes = 0slow_query_log_file = / data/logs/mysql57/slow.log

# log=/data/logs/mysql57/all.log

Automatically repair the record relay.info to the data table

Relay_log_info_repository = TABLE

Record the master.info into the data table

Master_info_repository = TABLE

Enable the automatic repair feature of relaylog

Relay_log_recovery = on

Delete automatically after the SQL thread executes a relaylog

Relay_log_purge = 1 security # data security configuration

Wei turns off master's ability to create function

Log_bin_trust_function_creators = on

Force writing to disk every time a transaction is executed

The sync_binlog = explicit timestamp column supports the null attribute if it is not explicitly defined as not null

Set the column value of timestamp to null and will not be set to current timestamp

Optimized configuration of explicit_defaults_for_timestamp=true###

Optimize the fuzzy index of Chinese full text

Ft_min_word_len = default library name table name is saved in lowercase and is not case-sensitive

Lower_case_table_names = maximum size limit for writing to a single record

Too small may cause failure to write (import) data

Max_allowed_packet = 256m

Semi-synchronous replication on

# rpl_semi_sync_master_enabled = 1#rpl_semi_sync_slave_enabled = half synchronous replication timeout setting

# rpl_semi_sync_master_timeout = 100percent replication mode (keep the system default)

# rpl_semi_sync_master_wait_point = AFTER_SYNC

As long as one of the backend receives the log and writes it to the relaylog, it will be successful.

# rpl_semi_sync_master_wait_slave_count = multithreaded replication

Parallel replication based on group submission

Slave_parallel_type = logical_clock

# number of parallel SQL threads. This parameter can only be set to 1.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report