centos dnf命令原始源安装mysql成功案例

centos dnf命令原始源安装mysql成功案例

在 CentOS 9 Stream 上安装 MySQL 全程使用root身份

第 1 步。首先,让我们首先确保您的系统是最新的。

dnf clean all
dnf update

步骤 2. 在 CentOS 9 Stream 上安装 MySQL。

默认情况下,MySQL 在 CentOS 9 Stream 基础存储库中可用。让我们使用以下命令安装 MySQL 服务器:

dnf install mysql mysql-server

验证 MySQL 安装:

mysql --version

安装完成后,现在启用 MySQL(系统启动时自动启动),启动 MySQL,并使用以下命令验证状态:

systemctl start mysqld
systemctl enable mysqld
systemctl status mysqld

步骤 3. 保护 MySQL。

默认情况下,MySQL 未加固。mysql_secure_installation您可以使用脚本保护 MariaDB 。你应该仔细阅读下面的每个步骤,这些步骤将设置一个 root 密码,删除匿名用户,禁止远程 root 登录,并删除测试数据库和访问安全 MySQL:

mysql_secure_installation

像这样配置它:

- Set root password? [Y/n] y
- Remove anonymous users? [Y/n] y
- Disallow root login remotely? [Y/n] y
- Remove test database and access to it? [Y/n] y
- Reload privilege tables now? [Y/n] y

这里下面是我的运行过程

[root@centos ~]# mysql_secure_installation

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

Press y|Y for Yes, any other key for No: y

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: low

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.

New password: 

Re-enter new password: 

Estimated strength of the password: 50 
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : yes
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) : yes
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! 

翻译,按需要自行取舍

在这里插入图片描述
在这里插入图片描述

如果您想连接到 MySQL 并开始向其中添加数据,请运行以下命令:

mysql -u root -p
密码是上面输入的密码

原文地址

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值