Centos7 YUM install MariaDB 10.0

Centos7 YUM install MariaDB 10.0

Installation steps (new installation)

  1. Configure to add yum source files

vim /etc/yum.repos.d/mariadb.repo

# MariaDB 10.0 CentOS repository list - created 2016-05-3002:16 UTC# http://downloads.mariadb.org/mariadb/repositories/[mariadb]
name = MariaDB
# baseurl = http://yum.mariadb.org/10.0/centos7-amd64
baseurl = http://archive.mariadb.org/mariadb-10.0.10/yum/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=0

For other versions, please refer to the official website to modify the version number

  1. Check whether the mariadb version corresponding to the configured yum source is correct yum makecache
    yum info MariaDB-server
  2. Install MariaDB-server and Client yum install MariaDB-server MariaDB-client MariaDB-devel -y
    Note: If there is a conflict with the previously installed version, you may need to remove the previously installed package first, for example: yum remove mariadb-libs.
  3. Create a new data directory and create a mysql user mkdir -p /data/dbdata/data/ && useradd mysql -s /sbin/nologin
  4. Initialize the database directory mysql_install_db --datadir='/data/dbdata/data/'
  5. Modify permissions and manually start chown mysql: mysl /data/dbdata/data/ -R
    cd '/usr' ; /usr/bin/mysqld_safe --datadir='/data/dbdata/data/' &
  6. Initialize database permissions
    mysql_secure_installation

Installation steps (install on the same MYSQL server)

  1. Configure to add yum source files

vim /etc/yum.repos.d/mariadb.repo

# MariaDB 10.0 CentOS repository list - created 2016-05-3002:16 UTC# http://downloads.mariadb.org/mariadb/repositories/[mariadb]
name = MariaDB
# baseurl = http://yum.mariadb.org/10.0/centos7-amd64
baseurl = http://archive.mariadb.org/mariadb-10.0.10/yum/centos6-amd64/
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=0

For other versions, please refer to the official website to modify the version number

  1. Check whether the mariadb version corresponding to the configured yum source is correct yum makecache
    yum info MariaDB-server
  2. Install MariaDB-server and Client yum install MariaDB-server MariaDB-client MariaDB-devel -y
    Note: If there is a conflict with the previously installed version, you may need to remove the previously installed package first, for example: yum remove mariadb-libs.
  3. Create a new data directory and create a mysql user mkdir -p /data/dbdata/data/ && useradd mysql -s /sbin/nologin
  4. Initialize the database directory mysql_install_db --datadir='/data/dbdata/data/' or mysql_install_db --defaults-file=/etc/mariadb/etc/my.cnf
  5. Modify permissions and manually start 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 &
  6. 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 ;

Production database configuration (for reference only)

[ 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

Centos7 YUM install MariaDB 10.0
CentOS 7.2 install MariaDB
CentOS 7.2 Yum install MySQL 5.6
Install MariaDB under MariaDB Centos7
centos install mysql through yum
Centos7 uses yum to install Apache, mariadb, PHP
1.5 Install Centos7
CentOS 7 yum install PHP7.3 tutorial
CentOS7 yum install and start mysql
Install java in yum mode in Centos
CentOS7 yum install and start mysql
How to install MariaDB on CentOS 8
Centos6 install Python2.7.13
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
Centos7 install Python 3.6.
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
Centos7 install Python2.7
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
centOs install rabbitMQ
Centos7 install Nginx
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
CentOS install jdk
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
CentOS8 install fastdfs6.06
CentOS 7 install Gitlab
Centos 7 install PostgreSQL
CentOS7 install MySQL8
CentOS 7 install Java 1.8
CentOS 6 install Docker
centos 6.5 install zabbix 4.4
Centos8 install Docker
CentOS6.8 install python2.7
CentOS install nodejs 8
CentOS6.5 install GNS3
centos 7.5 install mysql5.7.17
Centos7 install MySQL8.0-manual
CentOS7 install Kubernetes 1.16.3
VirtualBox install centos7