MariaDB10.3.X 安装部署(Centos7)
2021-04-01 本文已影响0人
eqieyiran
下载地址:
解压&移动&授权
tar -zxf mariadb-10.3.20-linux-glibc_214-x86_64.tar.gz
mv mariadb-10.3.20-linux-glibc_214-x86_64 /usr/local/mariadb
cd mariadb
chown -R mysql.mysql ./mariadb
编辑配置文件
mkdir -p /data/13306/data
vim /data/13306/my.cnf
[mysqld]
user=mysql
datadir = /data/13306/data
basedir = /usr/local/mariadb
log_error = /data/13306/data/mysql_error.log
socket = /data/13306/mysql.sock
tmpdir = /data/13306
innodb_log_group_home_dir = /data/13306/data
port = 13306
server_id = 1330620
character_set_server = utf8
default_storage_engine = INNODB
log_bin = binlog
binlog_format = ROW
binlog_ignore_db=information_schema,test
innodb_file_per_table = ON
innodb_flush_log_at_trx_commit = 1
slow_query_log = ON
long_query_time = 5
lower_case_table_names = 1
key_buffer_size = 1M
bulk_insert_buffer_size = 64M
large_pages
back_log = 50
max_connections = 500
max_connect_errors = 100000
table_open_cache = 2048
max_allowed_packet = 1G
binlog_cache_size = 1M
max_heap_table_size = 64M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
sort_buffer_size = 8M
join_buffer_size = 8M
thread_cache_size = 8
query_cache_type = 0
query_cache_size = 64M
query_cache_limit = 2M
ft_min_word_len = 4 #全文搜索 最小分词长度,一般修改为1
thread_stack = 256k
transaction_isolation = READ-COMMITTED #read-uncommitted read-committed repeatable-read serializable
tmp_table_size = 64M
#myisam
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1
myisam_recover
#INNODB
innodb_buffer_pool_size = 1G
innodb_data_file_path = ibdata1:10M:autoextend
innodb_write_io_threads = 8
innodb_read_io_threads = 8
innodb_thread_concurrency = 16
innodb_log_buffer_size = 8M
innodb_log_file_size = 512M
innodb_log_files_in_group = 2
innodb_max_dirty_pages_pct = 90
innodb_lock_wait_timeout = 120
gtid_strict_mode = ON
skip_name_resolve = ON
relay_log = mysql-relaylog
relay_log_index = mysql-relaylog
relay_log_purge = OFF
log_slave_updates=ON
chown -R mysql.mysql /data/13306
chown -R mysql.mysql /usr/local/mariadb
- 初始化并启动
/usr/local/mariadb/scripts/mysql_install_db --user=mysql --datadir=/data/13306/data
cd /usr/local/mariadb
/usr/local/mariadb/bin/mysqld_safe --datadir='/data/13306/data'
MariaDB 10.0 对应 Mysql 5.6
MariaDB 10.1 对应 Mysql 5.7
- 如下为yum安装
说明
官方yum源 访问地址,可根据需要选择替换:https://downloads.mariadb.org/mariadb/repositories/#distro=CentOS&distro_release=centos7-amd64--centos7&mirror=tuna&version=10.3
环境:
系统:CentOS Linux release 7.9.2009 (Core) # cat /etc/redhat-release 查看CentOS版本
数据库:MariaDB10.3.28 (GA版本)
vim /etc/
# MariaDB 10.3 CentOS repository list - created 2021-04-01 01:50 UTC
# http://downloads.mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.3/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
yum clean all && yum makecache
安装命令
yum install MariaDB-server MariaDB-client
启动MARIADB && 开机启动
systemctl start mariadb && systemctl enable mariadb
初始化
mysql_secure_installation
启动命令
systemctl status mariadb && systemctl start mariadb