Centos8安装mysql8.0

《Centos8安装mysql8.0》

通过以root用户或具有sudo特权的用户身份使用CentOS软件包管理器来安装MySQL 8.0服务器

# dnf install @mysql

服务器相关命令

# service mysqld restart
# service mysqld status
# systemctl enable mysqld.service

添加密码及安全设置

[root@localhost ~]# 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
//选择密码验证策略等级, 我这里选择0 (low),回车
Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 0
Please set the password for root here.
//输入新密码两次
New password: 

Re-enter new password: 
//确认是否继续使用提供的密码?输入y ,回车
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) : 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.
//是否删除匿名用户,删除,输入Y回车
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.
//是否删禁止root用户远程登录,输入N回车
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
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.

//是否删除测试数据库test,删除,输入Y回车
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.
//刷新权限,输入Y回车
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!

最后,默认root账号没有开启远程访问,外网访问需要开放3306端口,详细可以参考Centos7 mysql8.0安装

点赞

发表评论

邮箱地址不会被公开。 必填项已用*标注