安装与MySQL类似(一台服务器尽量不要同时安装MySQL和mariadb)

cd /usr/local/src //放置安装包路径(自定义) 下载地址(下载时间大概40-50分钟):wget 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

tar zxvf mariadb-10.2.6-linux-glibc_214-x86_64.tar.gz      //解压
mv mariadb-10.2.6-linux-glibc_214-x86_64 /usr/local/mariadb    //移动并重命名
cd /usr/local/mariadb
./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mariadb/ --datadir=/data/mariadb
cp support-files/my-small.cnf /usr/local/mariadb/my.cnf

/usr/local/mariadb/my.cnf配置文件中要定义datadir,防止与MySQL冲突

vi /usr/local/mariadb/my.cnf //定义basedir和datadir cp support-files/mysql.server /etc/init.d/mariadb vim /etc/init.d/mariadb //定义basedir、datadir、conf以及启动参数(定义conf目的是不和MySQL冲突) 若定义了conf,需要在下面配置中指定下路径

如果一个服务器中也安装了MySQL,需要停止MySQL服务,再启动mariadb /etc/init.d/mariadb start