Centos 7ソースインストールmariadb


1、指定したディレクトリへのインストールパッケージのダウンロードと解凍
ダウンロード先:https://downloads.mariadb.org/必要に応じて異なるソフトウェアバージョンをダウンロードできます
tar xf  mariadb-5.5.31-linux-x86_64.tar.gz   -C /usr/local/

2 mysqlグループとユーザーの作成
groupadd -r -g 306 mysql
useradd -r -g 306 -u 306 –d /data/mysql mysql

3、解凍ディレクトリに入り、ディレクトリの所有者と所属グループを設定する
cd /usr/local
ln -sv mariadb-5.5.31-linux-x86_64 mysql
chown -R root:mysql /usr/local/mysql/

4、プロファイルの準備
mkdir /etc/mysql/ #           
cp /usr/local/mysql/support-files/my-large.cnf /etc/mysql/my.cnf 

5、プロファイルの変更
vim /etc/mysql/my.cnf
[mysqld]       :
datadir = /data/mysql #        ,               mysql
innodb_file_per_table = on #             
skip_name_resolve = on #       ,    

6、データベースファイルの作成
cd /usr/local/mysql/
./scripts/mysql_install_db --datadir=/data/mysql --user=mysql

        :
./bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
     
yum -y install  libaio

7、サービススクリプトを準備し、サービスを開始する
cp ./support-files/mysql.server /etc/rc.d/init.d/mysqld
chkconfig --add mysqld
service mysqld start

8,PATHパスの設定
echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql

9、安全初期化
service mysqld restart #  mariadb  
/user/local/mysql/bin/mysql_secure_installation
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y #    root  
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y #        
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y #    root      
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y #    test 
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y #         ,     
 ... Success!

Cleaning up...

All done!  If you ave completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB