The file is as follows. Modify the file as needed:
#/Usr/share/mysql/my-huge.cnf
# MariaDB configuration file sample template (huge, giant ).
#
# This file applies to dedicated database servers with a memory of 1 GB to 2 GB.
# Only large MariaDB systems are running on the machine,
#
# The MariaDB program searches for a series of configuration files based on the operating system platform,
# You can copy the template configuration file to the corresponding location (and rename it ),
# To view which configuration files will be read, run the following command:
# 'My _ print_defaults -- help' and view
# Default options are read from the following files in the given order:
# (--> The program will read the listed configuration files in sequence.) The list of files (paths) listed below.
# For more information, see: http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In each section of this file, you can use all the options supported by this program.
# If you want to know whether a program supports a certain parameter,
# You can use the "-- help" option to start the program and view help information.
# The configuration options in the following section are read by all local MySQL clients as the default configuration
[Client]
# Password = your_password
Port = 3306
Socket =/var/lib/mysql. sock
# The following sections are read and parsed by various applications
# MySQL server configuration information
[Mysqld]
Port = 3306
Socket =/var/lib/mysql. sock
Skip-external-locking
Key_buffer_size = 384 M
Max_allowed_packet = 1 M
Table_open_cache = 512
Sort_buffer_size = 2 M
Read_buffer_size = 2 M
Read_rnd_buffer_size = 8 M
Myisam_sort_buffer_size = 64 M
Thread_cache_size = 8
Query_cache_size = 32 M
# Number of concurrent threads. We recommend that you multiply the number of CPU cores by 2: CPU's * 2 for thread_concurrency.
Thread_concurrency = 8
# You can specify the path of a dedicated disk as a temporary directory, such as SSD
# Tmpdir =/tmp/
# If this parameter is configured, no TCP/IP Port listener is enabled.
# If all the processing programs connect to mysqld only on the same machine, this is a safe practice,
# All interactions with mysqld can only be completed through Unix sockets or named pipes (named pipes.
# Note: This option is not used to enable named pipes on Windows ),
# (Using the "enable-named-pipe" configuration item) will cause mysqld to be unavailable!
# Skip-networking
# Master Server configuration option Replication Master Server (default)
# Binary logs are required for master-slave replication.
Log-bin = mysql-bin
# It must be a unique ID between 1 and 2 ^ 32-1 in the master-slave replication cluster. Otherwise, it may fail or cause a large number of error logs.
# If no master-host is set, the default value is 1.
# However, if it is omitted, the (master) will not take effect.
Server-id = 1
# Slave server configuration option Replication Slave (You Need To comment out the master part to use this part)
#
# To configure the server as a slave server (replication slave ),
# There are two options:
#
#1) use the change master to command (which is described in detail in the user manual )-
# Syntax:
#
# Change master to MASTER_HOST = # MASTER_USER = <user>, MASTER_PASSWORD = <password>;
#
# Replace # Replace <port> with the master port number (default value: 3306 ).
#
# An example is as follows:
#
# Change master to MASTER_HOST = '192. 564.12.1 ', MASTER_PORT = 125,
# MASTER_USER = 'job', MASTER_PASSWORD = 'secret ';
#
# Or:
#
#2) set the following parameters. However, once you select this method,
# When the master-slave replication is started for the first time (even if the replication fails to be started, for example, the wrong master-password,
# Leading to poor slave connection), slave will create a file named master.info,
# If you modify these parameters in this configuration file (xxx. cnf) later,
# Continue to use the content of the master.info file,
# Unless the slave server is disabled, the file master.info is deleted, and the slaver server is restarted.
# For this reason, you should not modify the following parameters (with <> comments ),
# Instead, use change master to (solution 1 above)
#
#
# The Master-slave replication cluster must be a unique ID between 2 and 2 ^ 32-1,
# Otherwise, it may fail or cause a large number of error logs.
# If master-host is set, the default value is 2.
# If this parameter is omitted, it will not become a Server Load balancer instance.
# Server-id = 2
#
# Master.-required to be connected to this slave
# Master-host = #
# Username required for slave connection to master Authentication
#-The user name is required (you can also specify it during connection)
# Master-user = <username>
#
# Password required for slave connection to master Authentication
#-The password is required (or can be specified during connection)
# Master-password = <password>
#
# Port number monitored by the master
# Optional-the default value is 3306.
# Master-port = <port>
#
# Enabling binary logs is not required for slave servers, but it is recommended to enable
# Log-bin = mysql-bin
#
# Binary log format-recommended mixed
# Binlog_format = mixed
# If only InnoDB tables are used, cancel the annotation of the following options.
# Innodb_data_home_dir =/var/lib/mysql
# Innodb_data_file_path = ibdata1: 2000 M; ibdata2: 10 M: autoextend
# Innodb_log_group_home_dir =/var/lib/mysql
# If InnoDB is used only, you can set .. _ buffer_pool_size to 50-80% of the physical memory.
# Beware of high memory usage settings
# Innodb_buffer_pool_size = 384 M
# Additional cache pool size
# Innodb_additional_mem_pool_size = 20 M
# Set .. _ log_file_size to about 25% of the buffer pool size
# Innodb_log_file_size = 100 M
# Log cache size. Do not set it to too large. Refresh once every 1 second.
# Innodb_log_buffer_size = 8 M
#1 by default, the log is refreshed to the hard disk when the transaction is committed;
# Set to 2, refresh to the operating system cache, but the performance is improved a lot. If it is set to 0, transactions may be lost.
# Innodb_flush_log_at_trx_commit = 1
# Table deadlock timeout release time, in seconds
# Innodb_lock_wait_timeout = 50
[Mysqldump]
# Quick export to output stream/hard disk, not cached in memory
Quick
# Maximum packet restrictions
Max_allowed_packet = 16 M
[Mysql]
No-auto-rehash
# If you are not familiar with SQL, you can remove the following annotator to reject insecure operations without where.
# Safe-updates
[Myisamchk]
Key_buffer_size = 256 M
Sort_buffer_size = 256 M
Read_buffer = 2 M
Write_buffer = 2 M
[Mysqlhotcopy]
Interactive-timeout
Install LAMP (Apache with MariaDB and PHP) in CentOS/RHEL/Scientific Linux 6)
Implementation of MariaDB Proxy read/write splitting
MariaDB details: click here
MariaDB's: click here
This article permanently updates the link address: