centos7安装mysql8.0
mysql文档地址是https://dev.mysql.com/doc/refman/8.0/en/linux-installation-yum-repo.html。
首先从https://dev.mysql.com/downloads/repo/yum/下载yum文件:
用命令下载:
wget https://dev.mysql.com/get/mysql80-community-release-el7-7.noarch.rpm
安装:
sudo yum install mysql80-community-release-el7-7.noarch.rpm
禁止mysql5.0:
sudo yum-config-manager --disable mysql57-community
启用mysql8.0:
sudo yum-config-manager --enable mysql80-community
查看结果:
yum repolist enabled | grep mysql
安装mysql server:
sudo yum install mysql-community-server
启动mysql服务:
sudo systemctl start mysqld
查看mysql临时密码:
sudo grep 'temporary password' /var/log/mysqld.log
复制上面的临时密码用作登录:
mysql -u root -p
更改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456Abcd;';