mysql8

卸载已经安装过的MySQL

检查是否已经安装

rpm -qa|grep mysql

卸载:

for i in $(rpm -qa|grep mysql);do rpm -e $i --nodeps;done
rm -rf /var/lib/mysql && rm -rf /etc/my.cnf

检查是否已经卸载

rpm -qa|grep mysql

 

安装MySQL

# 下载
wget http://repo.mysql.com/mysql80-community-release-el7-1.noarch.rpm
# 安装
sudo rpm -ivh mysql80-community-release-el7-1.noarch.rpm
sudo yum -y install mysql-server
# 开机启动
systemctl enable mysqld.service
#启动mysql
service mysqld start

 查看root临时密码

安装完mysql之后,会生成一个临时的密码让root用户登录

grep "temporary password" /var/log/mysqld.log

 

修改密码

alter user 'root'@'localhost' IDENTIFIED BY '123456'

 

posted @ 2022-04-16 19:55  Mr.peter  阅读(51)  评论(0编辑  收藏  举报