如何在Fedora 37上安装MySQL

MySQL是一种流行且广泛使用的开源关系数据库管理系统(RDBMS),许多基于Web的应用程序使用它来存储和管理数据。其强大的功能集和灵活性使其成为从小型项目到企业级应用程序的各种不同用例的理想选择。MySQL-Database

在 Fedora 37 上安装 MySQL

第 1 步。在继续之前,请更新您的 Fedora 操作系统以确保所有现有软件包都是最新的。使用此命令更新服务器软件包:

sudo dnf upgrade
sudo dnf update

第 2 步。在 Fedora 37 上安装 MySQL。

默认情况下,MySQL 软件包不在 Fedora 37 的默认存储库中。现在运行以下命令将 MySQL 存储库添加到您的 Fedora 系统中:

sudo dnf install https://dev.mysql.com/get/mysql80-community-release-fc37-1.noarch.rpm

添加 MySQL Yum 仓库后,您可以通过运行以下命令在 Fedora 37 系统上安装 MySQL:

sudo dnf install mysql-community-server

安装完成后,通过运行以下命令启动 MySQL 服务:

sudo systemctl start mysqld
sudo systemctl enable mysqld

要验证是否已安装 MySQL,请运行以下命令:

mysql --version

第 3 步。保护 MySQL 安装。

MySQL附带了一个脚本,可以帮助您保护安装。若要运行此脚本,请键入以下命令:

sudo mysql_secure_installation

此命令将启动MySQL安全安装向导,该向导将指导您完成保护MySQL服务器的过程。系统将提示您设置 root 密码、删除匿名用户、禁用远程 root 登录以及删除测试数据库。按照提示完成设置。

输出:

Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 
The 'validate_password' component is installed on the server.
The subsequent steps will run with the existing configuration
of the component.
Using existing password for root.

Estimated strength of the password: 100 
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y

New password: 

Re-enter new password: 

Estimated strength of the password: 100 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL 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? (Press y|Y for Yes, any other key for No) : 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? (Press y|Y for Yes, any other key for No) : y
Success.

All done!

感谢您使用本教程在您的 Fedora 37 系统上安装 MySQL 数据库。有关其他帮助或有用信息,我们建议您查看MySQL官方网站

未经允许不得转载:统信UOS之家 » 如何在Fedora 37上安装MySQL

相关文章