网址
//导入下载好的文件
[root@192 ~]# ls
anaconda-ks.cfg mysql80-community-release-el7-3.noarch.rpm
[root@192 ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm
warning: mysql80-community-release-el7-3.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql80-community-release-el7-3 ################################# [100%]
//yum默认安装8.0版本,修改为默认下载5.7版本
[root@192 ~]# cd /etc/yum.repos.d/
[root@192 yum.repos.d]# vim mysql-community.repo
[root@192 yum.repos.d]# yum clean all
[root@192 yum.repos.d]# yum repolist
//安装
[root@192 yum.repos.d]# yum -y install mysql-community-server.x86_64
[root@192 yum.repos.d]# systemctl start mysqld
[root@192 yum.repos.d]# netstat -anput | grep 3306
tcp6 0 0 :::3306 :::* LISTEN 2427/mysqld
//查看默认密码登入MySQL
[root@192 yum.repos.d]# grep password /var/log/mysqld.log
2020-11-20T19:26:06.421478Z 1 [Note] A temporary password is generated for root@localhost: n)_&wpYeh9P:
[root@192 yum.repos.d]# mysql -uroot -p'n)_&wpYeh9P:'
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.32
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
//修改root密码
mysql> alter user root@localhost identified by '123.comTT';
Query OK, 0 rows affected (0.00 sec)
mysql>