安装之前先卸载掉之前的mysql版本
官网找下载rpm安装源:
https://dev.mysql.com/downloads/repo/yum/
下载rpm安装源:
wget https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
本地安装:
yum localinstall mysql80-community-release-el7-3.noarch.rpm
查看可用安装源
[root@11111111111 ycj]# yum repolist all | grep mysql
mysql-cluster-7.5-community/x86_64 MySQL Cluster 7.5 Community disabled
mysql-cluster-7.5-community-source MySQL Cluster 7.5 Community - disabled
mysql-cluster-7.6-community/x86_64 MySQL Cluster 7.6 Community disabled
mysql-cluster-7.6-community-source MySQL Cluster 7.6 Community - disabled
mysql-cluster-8.0-community/x86_64 MySQL Cluster 8.0 Community disabled
mysql-cluster-8.0-community-source MySQL Cluster 8.0 Community - disabled
mysql-connectors-community/x86_64 MySQL Connectors Community enabled: 118
mysql-connectors-community-source MySQL Connectors Community - disabled
mysql-tools-community/x86_64 MySQL Tools Community enabled: 95
mysql-tools-community-source MySQL Tools Community - Sourc disabled
mysql-tools-preview/x86_64 MySQL Tools Preview disabled
mysql-tools-preview-source MySQL Tools Preview - Source disabled
mysql55-community/x86_64 MySQL 5.5 Community Server disabled
mysql55-community-source MySQL 5.5 Community Server - disabled
mysql56-community/x86_64 MySQL 5.6 Community Server disabled
mysql56-community-source MySQL 5.6 Community Server - disabled
mysql57-community/x86_64 MySQL 5.7 Community Server disabled
mysql57-community-source MySQL 5.7 Community Server - disabled
mysql80-community/x86_64 MySQL 8.0 Community Server enabled: 129
mysql80-community-source MySQL 8.0 Community Server - disabled
[root@1111111111 ycj]# yum repolist enabled | grep mysql
mysql-connectors-community/x86_64 MySQL Connectors Community 118
mysql-tools-community/x86_64 MySQL Tools Community 95
mysql80-community/x86_64 MySQL 8.0 Community Server 129
安装:
yum -y install mysql-community-server
启动:
[root@1111111 ycj]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@1111111 ycj]# service mysqld status
Redirecting to /bin/systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sun 2019-08-25 14:15:15 CST; 1min 30s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 26153 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 26228 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─26228 /usr/sbin/mysqld
Aug 25 14:15:05 iZuf60ajic0vbtdq7809vhZ systemd[1]: Starting MySQL Server...
Aug 25 14:15:15 iZuf60ajic0vbtdq7809vhZ systemd[1]: Started MySQL Server.
查看密码:
[root@1111111 ycj]# grep 'temporary password' /var/log/mysqld.log
2019-08-25T06:15:10.872858Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Mek&,ZIRf0Lg
登录:
mysql -u root -p
修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Newpassword.*!';
finished