Dead work
Because MariaDB's binary package mirroring source is at a foreign address, the package is downloaded in advance to the local physical machine and uploaded to the virtual machine/usr/local/src directory for installation using the lrzsz tool.
The physical address is (click to download directly to the physical machine):
https://downloads.mariadb.com/MariaDB/mariadb-10.2.6/bintar-linux-glibc_214-x86_64/mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
[root@adailinux src]# Yum install-y lrzsz //install lrzsz tool
[root@dl-001 ~]# Cd/usr/local/src //Upload local package to virtual terminal
[root@dl-001 src]# ls
[root@dl-001 src]# rz
[root@dl-001 src]# ls
mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz mysql-5.6.35-linux-glibc2.5-x86_64.tar.gz
1, Unzip Binary Compiled Package
[root@dl-001 src]# tar zxf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz
2, move to/usr/local/below
[root@dl-001 src]# mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb
[root@dl-001 local]# cd mariadb/
3, Initialization script, specify basedir and datadir
// Unlike mysql installation here, additional basedir needs to be specified
[root@dl-001 mariadb]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
Installing MariaDB/MySQL system tables in '/data/mariadb' ...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MariaDB root USER !
To do so, start the server, then issue the following commands:
'/usr/local/mariadb//bin/mysqladmin' -u root password 'new-password'
'/usr/local/mariadb//bin/mysqladmin' -u root -h localhost.localdomain password 'new-password'
Alternatively you can run:
'/usr/local/mariadb//bin/mysql_secure_installation'
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the MariaDB Knowledgebase at http://mariadb.com/kb or the
MySQL manual for more instructions.
You can start the MariaDB daemon with:
cd '/usr/local/mariadb/' ; /usr/local/mariadb//bin/mysqld_safe --datadir='/data/mariadb'
You can test the MariaDB daemon with mysql-test-run.pl
cd '/usr/local/mariadb//mysql-test' ; perl mysql-test-run.pl
Please report any problems at http://mariadb.org/jira
The latest information about MariaDB is available at http://mariadb.org/.
You can find additional information about the MySQL part at:
http://dev.mysql.com
Consider joining MariaDB's strong and vibrant community:
https://mariadb.org/get-involved/
4, copy the configuration file (select by server memory, here test select my-small.cnf)
# Here's how mysql and mariadb can coexist in one machine
# If you only have mariadb in your host machine, copy it directly to the / etc command and name it my.cnf; you can also modify the basedir
[root@dl-001 mariadb]# cp support-files/my-small.cnf /usr/local/mariadb/my.cnf
[root@dl-001 mariadb]# vi /usr/local/mariadb/my.cnf
//Insert the following under [mysqld]
basedir=/usr/local/mariadb
datadir=/data/mariadb
5, copy the startup script to / etc/init.d/directory and modify the contents
[root@dl-001 mariadb]# cp support-files/mysql.server /etc/init.d/mariadb
[root@dl-001 mariadb]# vi /etc/init.d/mariadb
//Modify Content
basedir=/usr/local/mariadb
datadir=/data/mariadb
confdir=$basedir/my.cnf //Newly added
//Add the --defaults-file option to the boot entry below to load the specified configuration file
$bindir/mysqld_safe --defaults-file="$confdir" --datadir="$datadir" --pid-file="$mysqld_pid_file_path" "$@" &
6, Start the script and verify success
[root@dl-001 mariadb]# /etc/init.d/mariadb start
Reloading systemd: [ Determine ]
Starting mariadb (via systemctl): [ Determine ]
[root@dl-001 mariadb]# ps aux | grep mysql
root 3466 0.5 0.1 115392 1736 ? S 13:04 0:00 /bin/sh /usr/local/mariadb//bin/mysqld_safe --defaults-file=/usr/local/mariadb/my.cnf --datadir=/data/mariadb --pid-file=/data/mariadb/localhost.localdomain.pid
mysql 3588 12.7 5.7 1125028 57864 ? Sl 13:04 0:00 /usr/local/mariadb/bin/mysqld --defaults-file=/usr/local/mariadb/my.cnf --basedir=/usr/local/mariadb/ --datadir=/data/mariadb/ --plugin-dir=/usr/local/mariadb/lib/plugin --user=mysql --log-error=/data/mariadb/localhost.localdomain.err --pid-file=/data/mariadb//localhost.localdomain.pid --socket=/tmp/mysql.sock --port=3306
root 3624 0.0 0.0 112676 972 pts/0 S+ 13:04 0:00 grep --color=auto mysql