CentOS 7 Linux 安装 MySQL mysql 5.7
#卸载mariadb/mysql
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -qa | grep mariadb
mariadb-5.5.52-1.el7.x86_64
mariadb-devel-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64
mariadb-libs-5.5.52-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e akonadi-mysql-1.9.2-4.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e mariadb-server-1:5.5.52-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e mariadb-devel-5.5.52-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e mariadb-5.5.52-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e perl-DBD-MySQL-4.023-5.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e qt-mysql-1:4.8.5-13.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e --nodeps redhat-lsb-core-4.1-27.el7.centos.1.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e postfix-2:2.10.1-6.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e qt3-MySQL-3.3.8b-51.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e qt5-qtbase-mysql-5.6.1-10.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e MySQL-python-1.2.5-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -e mariadb-libs-5.5.52-1.el7.x86_64
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -qa | grep mariadb
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -qa | grep mysql
#到此完全卸载mariadb/mysql
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -ivh mysql-community-common-5.7.18-1.el7.x86_64.rpm
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -ivh mysql-community-libs-5.7.18-1.el7.x86_64.rpm
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -ivh mysql-community-client-5.7.18-1.el7.x86_64.rpm
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# rpm -ivh mysql-community-server-5.7.18-1.el7.x86_64.rpm
警告:mysql-community-server-5.7.18-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
准备中... ################################# [100%]
正在升级/安装...
1:mysql-community-server-5.7.18-1.e################################# [100%]
#启动服务
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# systemctl start mysqld
@localhost init.d]# /bin/systemctl start mysqld.service
[root@localhost init.d]# chkconfig mysqld on
注意:正在将请求转发到“systemctl enable mysqld.service”。
[nescafe@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]$ rpm -ivh *rpm
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# /bin/systemctl start mysqld.service
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# sudo grep 'temporary password' /var/log/mysqld.log
2017-04-20T09:35:38.412872Z 1 [Note] A temporary password is generated for root@localhost: LC(7rVrhSSrw
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.7.18
Copyright (c) 2000, 2017, 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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@localhost mysql-5.7.18-1.el7.x86_64.rpm-bundle]# mysqladmin -p -u root shutdown
Enter password: