CentOS7安装MySQL8

下载rpm包

wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm

安装mysql

rom -ivh mysql80-community-release-el7-3.noarch.rpm

安装mysql-community-server,如果安装不上,进入/etc/yum.repos.d看下是否有mysql安装源

yum -y install mysql-server

启动mysql

systemctl start mysqld

mysql安装后系统会生成一个默认的root密码,执行以下命令获取

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

必须修改root密码后才能继续操作,修改root密码

mysql -u root -p

输入上面的临时密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码'

你可能感兴趣的:(CentOS7安装MySQL8)