1. 下载整合包
[root@master ~]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.12-1.el7.x86_64.rpm-bundle.tar
2. 解压整合包
[root@master ~]# tar -xvf mysql-8.0.12-1.el7.x86_64.rpm-bundle.tar
[root@master ~]# ls
mysql-8.0.12-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.12-1.el7.x86_64.rpm
mysql-community-common-8.0.12-1.el7.x86_64.rpm
mysql-community-devel-8.0.12-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.12-1.el7.x86_64.rpm
mysql-community-libs-8.0.12-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.12-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-8.0.12-1.el7.x86_64.rpm
mysql-community-server-8.0.12-1.el7.x86_64.rpm
mysql-community-server-minimal-8.0.12-1.el7.x86_64.rpm
mysql-community-test-8.0.12-1.el7.x86_64.rpm
注意:
可以使用rpm -pql
查看指定包生成的文件(路径)
例如:rpm -pql mysql-community-client-8.0.12-1.el7.x86_64.rpm
3. 安装依赖包
[root@master ~]# yum install mysql-community-{client,common,libs}-**
4. 安装服务端
[root@master ~]# rpm -ivh mysql-community-server-8.0.12-1.el7.x86_64.rpm
5. 启动服务
[root@master ~]# systemctl start mysqld
[root@master ~]# systemctl enable mysqld
6. 修改密码
[root@master ~]# grep 'temporary password' /var/log/mysqld.log
2019-04-15T02:32:09.005050Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: eWPEdEgj/5o:
[root@master ~]# mysql -uroot -p'eWPEdEgj/5o:'
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
注意
要求密码包含至少一个大写字母,一个小写字母,一个数字和一个特殊字符,并且总密码长度至少为8个字符。