#!/bin/bash

#Mariadb   superlee

#linux version centos6.7

cd /home/soft

wget https://downloads.mariadb.org/interstitial/mariadb-galera-10.0.16/bintar-linux-x86_64/mariadb-galera-10.0.16-linux-x86_64.tar.gz/from/http%3A//ftp.hosteurope.de/mirror/archive.mariadb.org/


[ -d /home/soft/mariadb-galera-10.0.16-linux-x86_64 ] || tar -zxvf mariadb-galera-10.0.16-linux-x86_64.tar.gz


mv /home/soft/mariadb-galera-10.0.16-linux-x86_64 mysql

groupadd mysql

useradd -g mysql -r mysql

cd /home/soft/mysql

./configure --prefix=/usr/local/mysql

make

make install

chown -R mysql.mysql mysql

/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/home/data/mysql --basedir=/usr/local/mysql &

cd /home/data/

chown -R mysql.mysql mysql/

/usr/local/mysql/bin/mysql_safe --user=mysql &

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

cp /home/soft/mysql/support-files/my-medium.cnf /etc/my.cnf


/usr/local/mysql/bin/mysqladmin -u root password '123456'

/usr/local/mysql/bin/mysql_secure_installation

/etc/init.d/mysqld start