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
- 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
- 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)
- 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
- 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/
- Add MySQL to system variables and create execution scripts
echo PATH=/usr/local/mysql/bin:$PATH > /etc/profile.d/mysql.sh
- Operation
cd /usr/local/mysql
scripts/mysql_ install_ db --datadir=/data/mysqldb --user=mysql
- 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
- Start the database
cp support-files/mysql. server /etc/init.d/mysqld
chkconfig --add mysqld
service mysqld start
- Execute security script
mysql_ secure_ installatio