当前位置:   article > 正文

在线环境安装MySQL8.0(yum安装)_yum install mysql8

yum install mysql8
1.下载安装包

wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

2.安装mysql的rpm包

yum -y install mysql80-community-release-el7-3.noarch.rpm

3.安装MySQL服务

yum install -y mysql-community-server --nogpgcheck

4.启动服务,设置自启动

systemctl start mysqld.service
systemctl enable mysqld.service

5.修改密码

grep "password" /var/log/mysqld.log    #查看初始密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';

sudo mysql_secure_installation

会有多个步骤: (注意这里设置密码,默认密码复杂度是中,需要 大写字母,小写字母,数字)

Enter password for user root:
输入刚刚得到的密码
New password:
输入新的密码
Re-enter new password:
重复输入新的密码
Change the password for root ? ((Press y|Y for Yes, any other key for No)
是否想改变root的密码,输入Y,重复设置密码。
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No)
输入Y
Remove anonymous users? (Press y|Y for Yes, any other key for No)
删除匿名用户,输入Y
Disallow root login remotely? (Press y|Y for Yes, any other key for No)
是否禁止远程登录,输入N(这个是允许远程登陆,但是设置好像不起效果)
Remove test database and access to it? (Press y|Y for Yes, any other key for No)
是否删除test数据库,输入Y
Reload privilege tables now? (Press y|Y for Yes, any other key for No)
是否重新加载到权限表,输入Y

6.登陆MySQL

mysql -u root -p

输入刚刚设置的密码进入mysql

7.密码规则,远程登陆设置

SHOW VARIABLES LIKE 'validate_password%';       #查看有哪些可用变量

SET GLOBAL validate_password.policy= 0;       #密码复杂度设置为低    1为中  2为高

set global validate_password.length = 6;    #设置密码最短长度

ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';    # 再次修改密码

create user root@"%" identified by "密码";      #新增允许远程root用户

grant all privileges on *.* to root@"%" with grant option;     #为新增的用户赋权  

8.测试远程登陆数据库

navicat连接测试

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号