MySQL 8.0 通过rpm包安装

mysql-8.0安装

#前往官网下载https://dev.mysql.com/downloads/mysql/
#按照顺序安装MySQL依赖
rpm -ivh mysql-community-common-8.0.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.31-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-compat-8.0.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.31-1.el7.x86_64.rpm
#初始化MySQL
mysqld --initialize --user=mysql
#开启MySQL服务
systemctl start mysqld
#查看MySQL的临时密码
cat /var/log/mysqld.log
#//PhPwCzkpE9-l
#进入MySQL
mysql -uroot -p
#修改初始密码
use mysql;
alter user 'root'@'localhost' identified by '123456';
#开启远程登录
update user set host='%' where user='root' and host='localhost';
#退出MySQL
exit;
#重启MySQL服务
systemctl restart mysqld
posted @ 2022-11-09 21:16  我吃大西瓜  阅读(442)  评论(0编辑  收藏  举报