- 上传/opt/modules,解压
链接: https://pan.baidu.com/s/1V8U7Rl_4LGh5XsdMkPJAYQ?pwd=6666
tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar
2、查看是否有mysql数据库
rpm -qa | grep mariadb
rpm -e mariadb-libs-5.5.64-1.el7.x86_64 --nodeps
- 依次安装所需服务
rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
yum install -y net-tools
yum install -y perl
yum install libaio
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
- 服务启动
systemctl start mysqld 这个是启动mysql
systemctl status mysqld 查看mysql的状态
systemctl stop mysqld 关闭服务
- 修改密码
1、先查看默认密码
grep password /var/log/mysqld.log
如何整一个非常好记的复杂密码:
yhedu 12345
可以这么干:Y1h2e3d4u5!
先将密码修改成一个复杂的密码:
alter user root@localhost identified by 'Y1h2e3d4u5!';
- 修改mysql的密码校验规则:
show variables like '%validate_password%'; # 查看密码策略
set global validate_password.policy=LOW; # 修改密码策略等级为LOW
set global validate_password.length=4; # 密码的最小长度
set global validate_password.mixed_case_count=0; # 设置密码中至少要包含0个大写字母和小写字母
set global validate_password.number_count=0; # 设置密码中至少要包含0个数字
set global validate_password.special_char_count=0; # 设置密码中至少要包含0个特殊字符
# 2. 修改密码
alter user root@localhost identified by '123456';
mysql8.0密码不能设置为root,否则报错!
- 修改mysql可以远程连接:
create user 'root'@'%' identified by '123456';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;// 刷新权限,让其立即起作用。
使用navicat 去连接mysql新版,会报错:
mysql命令窗口执行:ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456';