GNU/Linux >> Linux の 問題 >  >> Cent OS

CentOS6.4にMariaDBをインストールします

MariaDB

MariaDBは、コミュニティで開発されたMysqlのフォークであり、それに代わる優れた機能です。その無料のオープンソースであり、mysqlの元の開発者によって開発されています。 MariaDBは、機能の点でmysqlよりもはるかに優れています。 mariadbとmysqlの比較を確認してください。

そして最良のことは、それがmysqlのドロップイン置換であるということです。つまり、mysqlの代わりにmariadbをインストールするだけで、すべてのmysqlベースのアプリケーションが同じ方法で実行されます。すべてのコマンドとドライバーは同じように機能します。既存のphpmysqlアプリケーションは、phpのmysql拡張機能と同じように実行されます。

1。 CentOSにmariadbリポジトリを追加する

MariaDBはCentOSのデフォルトのリポジトリでは使用できないため、最初にMariaDBが提供するリポジトリを追加する必要があります。 MariaDBは、ubuntu、centos、debian、fedoraなどのディストリビューション用のリポジトリを提供します。

次のサイトにアクセスしてください
https://downloads.mariadb.org/mariadb/repositories/

リポジトリジェネレータです。 Linuxディストリビューション、バージョン、およびアーキテクチャを選択します。
次に、リポジトリを追加するための手順が表示されます。

5.5または10

MariDBには2つのシリーズがあります。 1つは5.5で、もう1つは新しい10.0シリーズです。 10.0シリーズには、mysqlまたは以前のバージョンのmariadbには存在しない新機能があります。 mariadb 10の機能を確認してください。
バージョン10.0の最新の機能が必要ない場合は、5.5シリーズを使用することをお勧めします。 mysqlから永続的に移行する場合は、互換性の問題を回避するために、最初にデータベースをmariadb 5.5にインポートしてから、バージョン10に移行できます。問題が発生した場合は、ircチャネル#mariadbにアクセスして、無料のヘルプを入手してください。

CentOS 6.4 x64で実行しているので、それに応じてオプションを選択します。 mariadb.orgは、私のディストリビューション用に次のリポジトリの詳細を提供してくれます。

Here is your custom MariaDB YUM repository entry for CentOS. Copy and paste it into a file under /etc/yum.repos.d/ (we suggest naming the file MariaDB.repo or something similar). See "Installing MariaDB with yum" for detailed information.
# MariaDB 5.5 CentOS repository list - created 2013-11-09 11:31 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/centos6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

そこで、/ etc / yum.repos.d / mariadb.repoというファイルを作成し、上記のテキストを入力します。

2。 yumを使用してmariadbをインストールする

次に、yum検索を実行して、リポジトリ内のそのパッケージを確認します。リポジトリが適切に構成されていることを確認し、後でinstallコマンドで使用する正確なパッケージ名を取得します。

# yum search mariadb
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.atlanticmetro.net
 * extras: centos.mirror.constant.com
 * rpmforge: mirror.us.leaseweb.net
 * updates: mirror.atlanticmetro.net
mariadb                                                                                                                                 | 1.9 kB     00:00
Not using downloaded repomd.xml because it is older than what we have:
  Current   : Wed Nov  6 07:36:52 2013
  Downloaded: Mon Sep 30 00:49:11 2013
==================================================================== N/S Matched: mariadb =====================================================================
MariaDB-cassandra-engine.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-client.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-common.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-compat.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-connect-engine.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-devel.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-server.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-shared.x86_64 : MariaDB: a very fast and robust SQL database server
MariaDB-test.x86_64 : MariaDB: a very fast and robust SQL database server
  Name and summary matches only, use "search all" for everything.

ご覧のとおり、必要なMariaDBパッケージがインストールできる状態になっています。次に、yuminstallを実行してタスクを完了します。

# yum install MariaDB-server MariaDB-client

これで、mariadbのインストールが完了します。

3。 mysqlサーバーを起動して接続します

まず、serviceコマンドを使用してmysqlサーバーを起動します。次に、mysqlコマンドを使用して接続します。

# service mysql start
Starting MySQL.. SUCCESS!
# mysql -u root
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 1
Server version: 5.5.33a-MariaDB MariaDB Server
Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>

上記のように、mysqlコマンドを使用すると、パスワードを要求せずにrootとして接続できました。これは、mariadbがデフォルトで構成されている方法であり、実稼働環境では安全ではありません。これを修正するには、次のセクションに示すように、rootパスワードを設定し、その他のセキュリティを改善する必要があります。

4。 mysql_secure_installationスクリプトを実行します

デフォルトでは、mariadbはrootパスワードや他の多くの安全でない設定なしでインストールされます。これらすべてを修正するには、mysql_secure_installationスクリプトを実行し、インストールを保護します。次のことを行います

1.rootパスワードを設定します
2。匿名ユーザーを削除する
3。リモートルートログインを禁止する
4。テストデータベースを削除する

# mysql_secure_installation
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found
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):
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] y
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
 ... 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
 - 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've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
[[email protected] public_html]#

終わり。これで、MariaDBの基本的なセキュリティ改善が行われました。

5。 MariaDBを起動時に開始できるようにする

chkconfigコマンドを使用して、mariadbが起動時に開始できるようにします。

# chkconfig mysql on

それでおしまい。これでMariaDBがインストールされ、使用できるようになりました。システムを再起動して、期待どおりに機能していることを確認することをお勧めします。サービスコマンドでステータスを確認してください

# service mysql status
 SUCCESS! MySQL running (1451)

Cent OS
  1. LinuxにMariaDBまたはMySQLをインストールする

  2. CentOSにInvoicePlaneをインストールする

  3. CentOS 6.x に MySQL 5.6 をインストールする方法

  1. CentOS7にMySQLをインストールする方法

  2. CentOSにMySQLServer5.6をインストールします

  3. CentOS6にMariaDB10.0をインストールします

  1. CentOS7にMariaDBをインストールする方法

  2. CentOS8にMySQLをインストールする方法

  3. CentOS7にMariaDBをインストールします