云网牛站
所在位置:首页 > Linux云数据库 > 在RHEL 8系统上安装MariaDB数据库的步骤

在RHEL 8系统上安装MariaDB数据库的步骤

2018-12-26 10:25:38作者:秦风稿源:云网牛站

本文介绍在RedHat Enterprise Linux 8(RHEL 8)系统上安装和配置MariaDB数据库,要安装的是MariaDB 10.3,它是一个多用户,多线程的SQL数据库,请按照以下步骤在RHEL 8上安装和配置MariaDB 10.3。

 

第1步:更新RHEL 8系统

请运行以下命令来更新RHEL 8系统:

sudo yum update

sudo yum upgrade

 

步骤2:在RHEL 8上安装MariaDB数据库

1、mariadb包在AppStream存储库中可用,可以通过运行命令来安装:

sudo yum module install mariadb

2、请使用y来确认安装,即让你选择[y/N]时选择y:

Transaction Summary

Install  13 Packages

Total download size: 32 M

Installed size: 164 M

Is this ok [y/N]: y

3、确认已安装MariaDB的版本

$ rpm -qi mariadb-server

在RHEL 8系统上安装MariaDB数据库的步骤

注:根据上面的信息可以得出,安装的版本是10.3.10 x86_64。

 

步骤3:在RHEL 8上启动并配置MariaDB

1、使用以下命令激活mariadb服务:

sudo systemctl enable --now php-fpm

2、启动服务后,运行命令mysql_secure_installation以强化MariaDB数据库安全性:

$ 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): 

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: <ENTER NEW PASSWORD>

Re-enter new password: <CONFIRM 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!

请确保:

设置数据库root用户密码。

删除匿名用户。

禁止root用户远程登录。

删除测试数据库并访问它。

3、完成后,使用root用户测试访问权限:

$ mysql -u root -p

在RHEL 8系统上安装MariaDB数据库的步骤

至此,已经成功的在RHEL 8上安装了MariaDB数据库。

另请阅读:在RHEL 8系统上安装Python 3和Python 2.7及设置默认Python版本

 

相关主题

Ubuntu安装MariaDB Server 10.3

精选文章
热门文章