vim /etc/yum.repos.d/mariadb.repo
For other versions, please refer to the official website to modify the version number
Check if the mariadb version corresponding to the configured yum source is correct
yum makecache yum info MariaDB-server
Install MariaDB-server and Client
yum install MariaDB-server MariaDB-client MariaDB-devel -y Note: If you are prompted to conflict with the previously installed version, you may need to remove the previously installed package first, for example: yum remove mariadb-libs.
Create a new data directory and create a mysql user
mkdir -p /data/dbdata/data/ && useradd mysql -s /sbin/nologin
Initialize the database directory
mysql_install_db --datadir='/data/dbdata/data/'
Modify permissions and start manually
chown mysql:mysl /data/dbdata/data/ -R cd '/usr' ; /usr/bin/mysqld_safe --datadir='/data/dbdata/data/' &
Initialize database permissions
mysql_secure_installation
vim /etc/yum.repos.d/mariadb.repo
For other versions, please refer to the official website to modify the version number
Check if the mariadb version corresponding to the configured yum source is correct
yum makecache yum info MariaDB-server
Install MariaDB-server and Client
yum install MariaDB-server MariaDB-client MariaDB-devel -y Note: If you are prompted to conflict with the previously installed version, you may need to remove the previously installed package first, for example: yum remove mariadb-libs.
Create a new data directory and create a mysql user
mkdir -p /data/dbdata/data/ && useradd mysql -s /sbin/nologin
Initialize the database directory
mysql_install_db --datadir='/data/dbdata/data/'
or
mysql_install_db --defaults-file=/etc/mariadb/etc/my.cnf
Modify permissions and start manually
chown mysql:mysl /data/dbdata/data/ -R cd '/usr' ; /usr/bin/mysqld_safe --datadir='/data/dbdata/data/' &
or
mysqld_safe --defaults-file=/etc/mariadb/etc/my.cnf &
Initialize database permissions mysql_secure_installation --defaults-file=/etc/mariadb/etc/my.cnf
or
mysql -h 127.0.0.1 -uroot -p -P3307 grant all privileges on . to 'root'@'localhost' identified by 'password'; grant all privileges on . to 'root'@'127.0.0.1' identified by 'password'; flush privileges ;
[ mysqld]
port =3307
socket =/tmp/mysql_mariadb.sock
character-set-server = utf8
collation-server = utf8_general_ci
innodb_page_size=16384
lower_case_table_names=1
server-id=10
innodb_buffer_pool_size=10G
skip-name-resolve
datadir =/data/dbdata/data/
relay-log =/data/dblogs/relay/relay.log
log-error =/data/dblogs/mysqld.err
tmpdir =/data/dbdata/tmpdir
innodb_flush_log_at_trx_commit =0
sync_binlog =0
query_cache_type =0
query_cache_size =0
bulk_insert_buffer_size = 2G
innodb_log_buffer_size = 256M
innodb_log_file_size = 1G
innodb_write_io_threads =16
innodb_doublewrite=0
auto_increment_increment =1
auto_increment_offset =1
autocommit = ON
character_set_server = utf8
connect_timeout =10
default_week_format =0
delay_key_write = ON
delayed_insert_limit =100
delayed_insert_timeout =300
delayed_queue_size =1000
div_precision_increment =4
event_scheduler = OFF
group_concat_max_len =1024
innodb_concurrency_tickets =5000
innodb_large_prefix = OFF
innodb_lock_wait_timeout =7200
innodb_max_dirty_pages_pct =70
innodb_old_blocks_pct =37
innodb_old_blocks_time =1000
innodb_purge_batch_size =300
innodb_read_ahead_threshold =56
innodb_stats_method = nulls_equal
innodb_stats_on_metadata = OFF
innodb_stats_sample_pages =8
innodb_strict_mode = OFF
innodb_table_locks = ON
innodb_thread_concurrency =0
innodb_thread_sleep_delay =10000
interactive_timeout =43200
key_cache_age_threshold =300
key_cache_block_size =1024
key_cache_division_limit =100
lock_wait_timeout =7200
log_queries_not_using_indexes = OFF
long_query_time =1.000000
low_priority_updates = OFF
max_allowed_packet = 1G
max_binlog_size =104857600
max_connect_errors =2000
max_connections =4096
max_prepared_stmt_count =16382
myisam_sort_buffer_size =4194304
net_buffer_length =16384
net_read_timeout =30
net_retry_count =10
net_write_timeout =300
query_alloc_block_size =8192
# query_cache_limit =1048576
# query_cache_size =67108864
# query_cache_type =0
query_prealloc_size =8192
slow_launch_time =2
# sort_buffer_size =6291456
sort_buffer_size = 2M
table_definition_cache =400
table_open_cache =10240
myisam_max_sort_file_size=10G
myisam_sort_buffer_size=2048M
tmp_table_size = 256M
thread_cache_size=10000
open_files_limit =10240
long_query_time =10
slow-query-log = on
slow-query-log-file =/data/dblogs/slow/slow.log
log-bin=/data/dbdata/binlog/mysql-bin
binlog_format = mixed
expire_logs_days =30
## Set from library
# Row is copied from the library safely,Slave primary key,Copy speed faster
# binlog_format=row
# Global transaction ID is convenient for master-slave construction and access
# gtid-mode=on
# Whether to enforce GTID consistency
# enforce-gtid-consistency=true
# Whether to record the data synchronization action from the server
log_slave_updates=1
# Ensure binary and server security in case of crash
# The record location of master information MariaDB does not have this parameter
# master-info-repository=TABLE
# The record location of relay log information MariaDB does not have this parameter
# relay-log-info-repository=TABLE
# After enabling, ensure that no information is lost
sync-master-info=1
# Setting the number of replication threads from the server MariaDB does not have this parameter
# slave-parallel-workers=8
# Enabling it can be used to record event-related information in the binary log, which can reduce the complexity of troubleshooting. MariaDB does not have this parameter
# binlog-rows-query-log-events=1
# Set the binlog check algorithm (cyclic redundancy check code)
binlog-checksum=CRC32
# Set whether the main server is verified
master-verify-checksum=1
# Set whether to verify from the server
slave-sql-verify-checksum=1
Recommended Posts