CentOS 8 快速简易的安装 MySQL 8

  CentOS 8 软件库中内置了MySQL  8,安装较CentOS 7 方便许多。

1、首先切换用户为root用户或者sudo特权用户执行下面的命令安装MySQL及其依赖

dnf install @mysql

2、安装完成后,启动mysql

systemctl enable --now mysqld

3、启动成功查看mysql状态

systemctl status mysqld

4、运行mysql_secure_installation脚本

[root@localhost ~]# mysql_secure_installation

(1)首先会提示你配置验证密码插件,这里可以不选择直接Enter

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: 

(2)提示你设置root密码,设置一个密码即可

Please set the password for root here.

(3)提示你是否删除匿名用户

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.

(4)提示你是否禁止root用户远程登录

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.
(5)提示你是否删除测试数据库

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

(6)提示你是否重新加载授权信息

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

5、配置完成后使用设置的密码登录mysql


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜未央,流年殇

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值