一 下載mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar
[root@localhost mysql-community]# tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar
mysql-community-embedded-devel-5.7.19-1.el7.x86_64.rpm
mysql-community-client-5.7.19-1.el7.x86_64.rpm
mysql-community-server-5.7.19-1.el7.x86_64.rpm
mysql-community-test-5.7.19-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.19-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.19-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.19-1.el7.x86_64.rpm
mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-embedded-5.7.19-1.el7.x86_64.rpm
mysql-community-devel-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-5.7.19-1.el7.x86_64.rpm
二 準(zhǔn)備安裝
[root@localhost mysql-community]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
mysql-community-client(x86-64) >= 5.7.9 is needed by mysql-community-server-5.7.19-1.el7.x86_64
mysql-community-common(x86-64) = 5.7.19-1.el7 is needed by mysql-community-server-5.7.19-1.el7.x86_64
mariadb-server is obsoleted by mysql-community-server-5.7.19-1.el7.x86_64
安裝時(shí)候會(huì)提示與已經(jīng)安裝的RPM包有沖突,所以我們先卸載一些RPM包训堆,要卸載哪些呢露戒?我們要卸載的是包含有mariadb關(guān)鍵字的RPM包椒功,執(zhí)行命令:rpm -qa|grep mariadb來查看一下我們要卸載哪些軟件:
[root@localhost mysql-community]# rpm -qa|grep mariadb
mariadb-devel-5.5.52-1.el7.x86_64
mariadb-5.5.52-1.el7.x86_64
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64
卸載mariadb:
[root@localhost mysql-community]# rpm -e --nodeps mariadb-libs-5.5.52-1.el7.x86_64
[root@localhost mysql-community]# rpm -e --nodeps mariadb-server-5.5.52-1.el7.x86_64
[root@localhost mysql-community]# rpm -e --nodeps mariadb-5.5.52-1.el7.x86_64
[root@localhost mysql-community]# rpm -e --nodeps mariadb-devel-5.5.52-1.el7.x86_64
[root@localhost mysql-community]# rpm -qa|grep mariadb
三 安裝
按以下順序安裝MySQL
[root@localhost mysql-community]# rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.19-1.e################################# [100%]
[root@localhost mysql-community]# rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.19-1.el7################################# [100%]
[root@localhost mysql-community]# rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.19-1.e################################# [100%]
[root@localhost mysql-community]# rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.19-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.19-1.e################################# [100%]
[root@localhost mysql-community]#
四 測(cè)試
mysql配置文件為/etc/my.cnf
修改編碼配置:
[mysql]
default-character-set =utf8
service mysqld restart
mysql> set password for 'root'@'localhost' =password('password');
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on . to root@'%'identified by 'password';
參考:
http://www.cnblogs.com/starof/p/4680083.html
http://jingyan.baidu.com/article/93f9803f010d8fe0e56f555e.html