Here, the mariadb version 10.2.15 is installed in the centos 7 environment; The following is the download link provided on the official website;

https://archive.mariadb.org//mariadb-10.2.15/bintar-linux-x86_64/mariadb-10.2.15-linux-x86_64.tar.gz

  1. Upload the database package to the centos system and check whether the system has a MySQL account and whether there are mariadb data of the same version but different versions

getent passwd mysql

rpm -q mariadb-server

How to find a MySQL account or a mariad database? Please delete or uninstall it first

Userdel - r mysql deletes the account and home directory

Rpm - e mariadb server Uninstalls the database

  1. Create the database account required for binary installation. Here, create the system account mysql and generate the home directory (to store the database data in production). And shell type

useradd -r -d /data/mysqldb -s /sbin/nologin mysql

cd /

Mkdir/data/mysqldb (create home directory)

chown mysql. MySQL/data/mysqldb (specify the home directory user and mysql as the group)

  1. Unzip mariadb-10.2.15-linux-x86_ 64.tar. Gz Specify the database installation path to/uer/local

tar xvf mariadb-10.2.15-linux-x86_ 64.tar. gz -C /usr/local

cd /usr/local

  1. Create a soft connection to the unpacking directory and specify the account and group

ln -s mariadb-10.2.15-linux-x86_ 64/ mysql

chown -R root:root mysql/

  1. Add MySQL to system variables and create execution scripts

echo PATH=/usr/local/mysql/bin:$PATH > /etc/profile.d/mysql.sh

  1. Operation

cd /usr/local/mysql

scripts/mysql_ install_ db --datadir=/data/mysqldb --user=mysql

  1. Specify the storage location of database data

cd /usr/local/mysql

cp support-files/my-huge. cnf /etc/my.cnf

vim /etc/my.cnf

Add in [mysqld]

datadir = /data/mysqldb

  1. Start the database

cp support-files/mysql. server /etc/init.d/mysqld

chkconfig --add mysqld

service mysqld start

  1. Execute security script

mysql_ secure_ installatio

Was this answer helpful? 0 Users Found This Useful (0 Votes)