在RHEL/CentOS上安裝和配置MariaDB

來源:互聯網
上載者:User

在RHEL/CentOS上安裝和配置MariaDB

MariaDB是一個開源的關聯式資料庫,是一個社區開發的MySQL資料庫分支版本。 MariaDB已經取代了MySQL作為RHEL/CentOS 7中的預設資料庫。

在本教程中,我們將討論在CentOS/RHEL 7機器上安裝和配置MariaDB。

(適用於初學者的MariaDB管理命令 )

安裝

從RHEL / CentOS 7開始,MariaDB可用於兩個作業系統的預設存放庫。 所以我們可以簡單地使用yum進行安裝。 要安裝它,請從終端執行以下命令,

$ yum install mariadb mariadb-server

一旦安裝,我們將開始它的服務,並啟用它,

$ systemctl start mariadb
$ systemctl enable mariadb

資料庫現在正在運行,您可以通過運行登入到Mariadb

$ mysql

在終端。 root使用者的預設密碼預設為空白,你可以想象這是一個嚴重的安全威脅。 所以我們現在將確保我們的安裝。

配置MariaDB

我們現在將通過在我們的終端中運行“mysql_secure_installation”來保護我們的MariaDB安裝。 確保您仔細閱讀程式的每一步,以確保安裝,

$ 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: ROOTPASSWORD
Re-enter new password: ROOTPASSWORD
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, yourMariaDB
installation should now be secure.


Thanks for using MariaDB!

就這樣,我們的資料庫現在是安全的,可以使用了。 我們現在可以通過使用登入到我們安裝的MariaDB。

$ mysql –u root –p

可以繼續建立新的資料庫,表或使用者。

這是我們關於安裝和配置MariaDB的教程。如果有任何疑問或問題,請在下面的評論框中提及。

更多MariaDB相關教程見以下內容:

Ubuntu 16.04 LTS 上安裝 Nginx、MariaDB 和 HHVM 運行 WordPress 

Ubuntu 16.04 Dockerfile 安裝MariaDB 

Linux系統教程:如何檢查MariaDB服務端版本 

Ubuntu 16.04下如何安裝MariaDB 

CentOS 7.3二進位安裝MariaDB10.2.8步驟 

CentOS 7 編譯安裝MariaDB-10.1.22 

Ubuntu 上如何將 MySQL 5.5 資料庫遷移到 MariaDB 10 

[翻譯]Ubuntu 14.04 (Trusty) Server 安裝 MariaDB 

MariaDB 的詳細介紹:請點這裡
MariaDB 的:請點這裡

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.