--------------------------------

mariadb インストール ( centos7 バージョンでは、mariadbデータベースを使用)
[root@falcon21 ~]# yum -y install mariadb-server
インストール:
  mariadb-server.x86_64 1:5.5.60-1.el7_5

依存性関連をインストールしました:
  mariadb.x86_64 1:5.5.60-1.el7_5                      perl-Compress-Raw-Bzip2.x86_64 0:2.061-3.el7
  perl-Compress-Raw-Zlib.x86_64 1:2.061-4.el7          perl-DBD-MySQL.x86_64 0:4.023-6.el7
  perl-DBI.x86_64 0:1.627-4.el7                        perl-IO-Compress.noarch 0:2.061-2.el7
  perl-Net-Daemon.noarch 0:0.48-5.el7                  perl-PlRPC.noarch 0:0.2020-14.el7

完了しました!


MariaDB設定
[root@falcon21 ~]# vi /etc/my.cnf.d/server.cnf
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/mysql/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the mysqld standalone daemon
[mysqld]
character-set-server = utf8

# this is only for embedded server
[embedded]

# This group is only read by MariaDB-5.5 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mysqld-5.5]

# These two groups are only read by MariaDB servers, not by MySQL.
# If you use the same .cnf file for MySQL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

[mariadb-5.5]



MariaDB起動
[root@falcon21 ~]# systemctl start mariadb
[root@falcon21 ~]# systemctl enable mariadb
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.

[root@falcon21 ~]# systemctl status mariadb -l
 mariadb.service - MariaDB database server
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled)
   Active: active (running) since 日 2019-02-17 17:25:16 JST; 1min 18s ago
 Main PID: 17137 (mysqld_safe)
   CGroup: /system.slice/mariadb.service
           ├─17137 /bin/sh /usr/bin/mysqld_safe --basedir=/usr
           └─17311 /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mariadb/mariadb.log --pid-file=/var/run/mariadb/mariadb.pid --socket=/var/lib/mysql/mysql.sock

 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: MySQL manual for more instructions.
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: Please report any problems at http://mariadb.org/jira
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: The latest information about MariaDB is available at http://mariadb.org/.
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: You can find additional information about the MySQL part at:
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: http://dev.mysql.com
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: Consider joining MariaDB's strong and vibrant community:
 2月 17 17:25:13 falcon21.space mariadb-prepare-db-dir[17058]: https://mariadb.org/get-involved/
 2月 17 17:25:13 falcon21.space mysqld_safe[17137]: 190217 17:25:13 mysqld_safe Logging to '/var/log/mariadb/mariadb.log'.
 2月 17 17:25:13 falcon21.space mysqld_safe[17137]: 190217 17:25:13 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
 2月 17 17:25:16 falcon21.space systemd[1]: Started MariaDB database server.


MariaDB初期設定
[root@falcon21 ~]# mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):   ← 空ENTER
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n]    ← 空ENTER
New password:               rootパスワード設定
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]    ← 空ENTER(匿名ユーザー削除)
 ... 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]   ← 空ENTER(リモートからの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]   ← 空ENTER(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]    ← 空ENTER
 ... Success!

Cleaning up...

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

Thanks for using MariaDB!

--------------------------------------------------------

MariaDB確認
[root@falcon21 ~]# mysql -u root -p
Enter password:     
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 10
Server version: 5.5.60-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>select user,host,password from mysql.user;    // ユーザー情報一覧表示
+------+-----------+-------------------------------------------+
| user | host      | password                                  |
+------+-----------+-------------------------------------------+
| root | localhost | *0B0B60366C2AF11CF3D216A010504C7A42320078 |
| root | 127.0.0.1 | *0B0B60366C2AF11CF3D216A010504C7A42320078 |
| root | ::1       | *0B0B60366C2AF11CF3D216A010504C7A42320078 |
+------+-----------+-------------------------------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> show databases;             //データベース一覧表示
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]> exit
Bye

********************************************************************************************

MariaDBの公式リポジトリを追加し、そちらから最新バージョンをインストール
 
-----------------------------------------------
[[root@falcon21 ~]# curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
[info] Repository file successfully written to /etc/yum.repos.d/mariadb.repo.
[info] Adding trusted package signing keys...
[info] Succeessfully added trusted package signing keys.
 
 
[root@falcon21 ~]# yum install MariaDB-server MariaDB-client
インストール:
  MariaDB-client.x86_64 0:10.3.12-1.el7.centos  MariaDB-compat.x86_64 0:10.3.12-1.el7.centos
  MariaDB-server.x86_64 0:10.3.12-1.el7.centos
 
依存性関連をインストールしました:
  MariaDB-common.x86_64 0:10.3.12-1.el7.centos  boost-program-options.x86_64 0:1.53.0-27.el7
  galera.x86_64 0:25.3.12-2.el7                 nmap-ncat.x86_64 2:6.40-16.el7
 
置換:
  mariadb.x86_64 1:5.5.60-1.el7_5                mariadb-libs.x86_64 1:5.5.60-1.el7_5
  mariadb-server.x86_64 1:5.5.60-1.el7_5
 
完了しました!
 
-----------------------------------------
 
サービス開始
[root@falcon21 ~]# systemctl restart mariadb
 
Created symlink from /etc/systemd/system/mysql.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/mysqld.service to /usr/lib/systemd/system/mariadb.service.
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
 
 
 
[root@falcon21 ~]# mysql_secure_installation
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none):        ・・・ 空Enter
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
Enter current password for root (enter for none):    ・・・・・・・・  rootパス
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
 
You already have a root password set, so you can safely answer 'n'.
 
Change the root password? [Y/n] y               ・・・y
New password:                         ・・・・  rootパス
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]
 ... 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]
 ... 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]
 - 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]
 ... Success!
 
Cleaning up...
 
All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.
 
Thanks for using MariaDB!
[root@falcon21 ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 20
Server version: 10.3.12-MariaDB MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| anthy              |
| blender1           |
| falcon21           |
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| sns                |
| sns1               |
+--------------------+
9 rows in set (0.000 sec)
 
MariaDB [(none)]> exit
Bye
 
***********************************************
 
 

投票数:2 平均点:10.00

 
Back to Top