CentOS7.9安装mysql-8.0.28(最新)

一、下载

MySQL :: Download MySQL Yum Repositoryhttps://dev.mysql.com/downloads/repo/yum/下载安装源

CentOS7.9安装mysql-8.0.28(最新)_第1张图片

二、将rpm包上传到服务器

省略

三、卸载mariadb

[root@XXXXX home]# rpm -qa | grep mariadb
mariadb-libs-5.5.68-1.el7.x86_64
[root@XXXXX home]# rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
[root@XXXXX home]# 

四、安装源

[root@iZuf63ffnpp8kxcttq0dghZ opt]# rpm -ivh mysql80-community-release-el7-5.noarch.rpm 
warning: mysql80-community-release-el7-5.noarch.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql80-community-release-el7-5  ################################# [100%]

五、安装mysql服务

yum install mysql-community-server

六、启动

[root@iZuf63ffnpp8kxcttq0dghZ opt]# systemctl start mysqld

七、登录数据库

# 查看初始密码
nano /var/log/mysqld.log

CentOS7.9安装mysql-8.0.28(最新)_第2张图片

[root@iZuf63ffnpp8kxcttq0dghZ home]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.28

Copyright (c) 2000, 2022, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

八、修改密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

# 碰到以上情况,将修改密码并修改密码强度

ALTER USER 'root'@'localhost' IDENTIFIED BY 'fhksjfs@HHH123';

# 密码修改成功后执行

set global validate_password.policy=low;
set global validate_password.length=6;

# 最后在执行就可以了
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';

九、远程访问

use mysql

update user set user.Host='%' where user.User='root';

flush privileges;

systemctl restart mysqld

十、文件

配置文件  /etc/my.cnf
日志:/var/log/mysqld.log

你可能感兴趣的:(mysql,mysql,数据库,database)