软件安装
1) 需先卸载mariadb-server、mariadb-common
yum remove mariadb-server mariadb-common # 卸载mariadb-server、mariadb-common
2) 下载
mysql-community-client-8.0.20-1.el8.x86_64.rpm
mysql-community-libs-8.0.20-1.el8.x86_64.rpm
mysql-community-common-8.0.20-1.el8.x86_64.rpm
mysql-community-server-8.0.20-1.el8.x86_64.rpm
下载地址如下:
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-server-8.0.20-1.el8.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-client-8.0.20-1.el8.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-libs-8.0.20-1.el8.x86_64.rpm
https://downloads.mysql.com/archives/get/p/23/file/mysql-community-common-8.0.20-1.el8.x86_64.rpm
3) 安装mysql8.0
#yum install -y ./mysql-community-*
安装mysql8.0
使用yum安装本地文件会自动补全依赖
4) 启动mysqld
# systemctl start mysqld
启动mysql
5) MySQL默认密码和修改密码
#grep 'temporary password' /var/log/mysqld.log
#mysql -uroot -p # 查看mysql默认密码并登录数据库
修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Zhang.409'; # 修改默认密码为自己想要的密码
重新登录
使用新密码登录数据库
验证数据库
create database shujuku charset utf8; # 新建库
show databases; # 查询库
通过增删改查等简单操作验证数据库是否安装成功