首页 » PHP教程 » centosmariadbphp技巧_若安在CentOS8或者RHEL8系统上安装MariaDB

centosmariadbphp技巧_若安在CentOS8或者RHEL8系统上安装MariaDB

访客 2024-12-02 0

扫一扫用手机浏览

文章目录 [+]

如需学习视频,请在微信搜索公众年夜众号“智传网优”直接开始自助视频学习

1. 序言

本文紧张是为帮助您在RHEL8或CentOS8上安装MariaDB而编写的。
讲解如何在CentOS8或RHEL8上安装MariaDB数据库做事器。
CentOS8是与MariaDB 10.3一起发布的,它与MySQL是二进制兼容的。
MariaDB 10.3是一个多用户、多线程的SQL数据库做事器。
你可以在我之前的文章Red Hat Enterprise Linux 8 (RHEL 8)的新特性和评论中找到所有的RHEL8新特性

centosmariadbphp技巧_若安在CentOS8或者RHEL8系统上安装MariaDB

MariaDB是一个社区开拓的MySQL关系型数据库管理系统的分支。
它是一个快速和健壮的数据库做事器,在它的开拓和改进背后有一个巨大的社区。

centosmariadbphp技巧_若安在CentOS8或者RHEL8系统上安装MariaDB
(图片来自网络侵删)

如何在CentOS8或者RHEL8系统上安装MariaDB

2. RHEL8 上的 MariaDB 10.3版本 vs RHEL7系统上的5.5版本

MariaDB 10.3在RHEL 8中供应了比在RHEL 7中供应的5.5更多的新特性。
一些新的变革是:

InnoDB被用作默认的存储引擎,而不是XtraDB。
System-versioned表FOR循环MariaDB Galera集群是一个同步多主集群,现在是MariaDB的标准部分。
序列即时添加列InnoDB看不见的列并行复制多源复制公共表表达式独立于存储引擎的列压缩3. 在CentOS8或RHEL8上安装MariaDB 10.3

按照以下步骤在RHEL8或CentOS8上安装和配置MariaDB 10.3。

在CentOS8或RHEL8上安装MariaDB 10.3

3.1 步骤1: 升级你的RHEL 8系统

sudo dnf -y update3.2 步骤2: 在CentOS8或RHEL8上安装MariaDB数据库做事器

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

sudo dnf module install mariadb

在CentOS8或RHEL8上安装MariaDB数据库做事器

按下y确认安装

Transaction Summary=======================================================================================================================================================Install  13 PackagesTotal download size: 32 MInstalled size: 164 MIs this ok [y/N]: y

检讨MariaDB的安装情形

rpm -qi mariadb-server

Name : mariadb-serverEpoch : 3Version : 10.3.10Release : 2.el8+2039+dffd8723Architecture: x86_64Install Date: Sat 01 Dec 2018 04:31:39 AM ESTGroup : UnspecifiedSize : 87570890License : GPLv2 with exceptions and LGPLv2 and BSD.Signature : RSA/SHA256, Mon 15 Oct 2018 05:22:06 AM EDT, Key ID 199e2f91fd431d51Source RPM : mariadb-10.3.10-2.el8+2039+dffd8723.src.rpmBuild Date : Fri 12 Oct 2018 09:48:53 AM EDTBuild Host : x86-vm-05.build.eng.bos.redhat.comRelocations : (not relocatable)Packager : Red Hat, Inc. http://bugzilla.redhat.com/bugzillaVendor : Red Hat, Inc.URL : http://mariadb.orgSummary : The MariaDB server and related filesDescription :MariaDB is a multi-user, multi-threaded SQL database server. It is aclient/server implementation consisting of a server daemon (mysqld)and many different client programs and libraries. This package containsthe MariaDB server and some accompanying files and directories.MariaDB is a community developed branch of MySQL.

3.3 步骤3: 在CentOS8或者RHEL 8上启动和配置MariaDB

利用下面的命令激活mariadb做事,即设置开机自启动:

sudo systemctl enable --now mariadb

在CentOS8或者RHEL 8上启动和配置MariaDB

做事启动后,运行命令mysql_secure_installation来加强MariaDB数据库做事器的安全性。

mysql_secure_installation

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

In order to log into MariaDB to secure it, we'll need the currentpassword for the root user. If you've just installed MariaDB, andyou 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 MariaDBroot user without the proper authorisation.

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

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

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

Normally, root should only be allowed to connect from 'localhost'. Thisensures 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 canaccess. This is also intended only for testing, and should be removedbefore 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 farwill 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 MariaDBinstallation should now be secure.

Thanks for using MariaDB!

以上操作确保你:

设置数据库root用户密码删除匿名用户不许可root用户远程登录删除测试数据库并访问它

完成后,利用root用户测试访问

mysql -u root -p

Enter password:Welcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 16Server version: 10.3.10-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 VERSION();+-----------------+| VERSION() |+-----------------+| 10.3.10-MariaDB |+-----------------+1 row in set (0.001 sec)

4. 总结

通过本教程,您现在可以在CentOS8或RHEL8上安装MariaDB数据库做事器了。
如果您更喜好通过web界面管理MariaDB数据库做事器,请参阅我们的指南,理解如何在RHEL 8上安装和配置phpMyAdmin。

本文已同步至博客站,尊重原创,转载时请在正文中附带以下链接:https://www.linuxrumen.com/rmxx/1478.html点击理解更多,快速查看更多的技能文章列表。

标签:

相关文章

CS15武器购买指南战场胜势的利器

在《反恐精英》(Counter-Strike,简称CS)系列游戏中,武器作为玩家战胜敌人的关键道具,一直以来都备受关注。全新的武器...

PHP教程 2025-04-14 阅读1 评论0

H2SeO3还原化学反应中的奇妙之旅

在化学领域,还原反应一直是人们关注的焦点。作为一种重要的氧化还原反应,H2SeO3还原性研究对于理解化学变化、开发新型材料以及推动...

PHP教程 2025-04-14 阅读1 评论0

HL122govcn考试预约开启公职生涯的第一步

在现代社会,成为一名公务员,实现自身价值的为国家和人民服务,已经成为越来越多人的梦想。而要实现这个梦想,首先必须通过HL122go...

PHP教程 2025-04-14 阅读1 评论0

7000系列引领时代潮流的科技巨头代际更迭

各大科技巨头纷纷推出新一代产品,以满足消费者日益增长的消费需求。在这其中,7000系列作为各大品牌的旗舰产品,备受关注。本文将带您...

PHP教程 2025-04-14 阅读1 评论0

20星服务在SEO关键词排名中的火热地位

搜索引擎优化(SEO)已成为企业提升品牌知名度、扩大市场份额的重要手段。在众多SEO服务中,关键词排名显得尤为重要。“20星服务”...

PHP教程 2025-04-14 阅读1 评论0