centos7 下載指定版本mysql


1:查看 mysql  yum源 (沒有則編輯添加進去)

cat /etc/yum.repos.d/mysql-community.repo
[root@localhost mysql5.7.30]# cat /etc/yum.repos.d/mysql-community.repo 
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl=http://repo.mysql.com/yum/mysql-connectors-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql-tools-community]
name=MySQL Tools Community
baseurl=http://repo.mysql.com/yum/mysql-tools-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Enable to use MySQL 5.5
[mysql55-community]
name=MySQL 5.5 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.5-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Enable to use MySQL 5.6
[mysql56-community]
name=MySQL 5.6 Community Server
baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/
enabled=0
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

# Note: MySQL 5.7 is currently in development. For use at your own risk.
# Please read with sub pages: https://dev.mysql.com/doc/relnotes/mysql/5.7/en/
[mysql57-community-dmr]
name=MySQL 5.7 Community Server Development Milestone Release
baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
enabled=1
gpgcheck=1
gpgkey=file:/etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

2:下載mysql5.7.30

yum install --downloadonly --downloaddir=/song  mysql-community-client-5.7.30 mysql-community-common-5.7.30 mysql-community-libs-5.7.30 mysql-community-server-5.7.30

下載詳情如下

[root@localhost song]# yum install --downloadonly --downloaddir=/song  mysql-community-client-5.7.30 mysql-community-common-5.7.30 mysql-community-libs-5.7.30 mysql-community-server-5.7.30
已加載插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
正在解決依賴關系
--> 正在檢查事務
---> 軟件包 mysql-community-client.x86_64.0.5.7.30-1.el7 將被 安裝
---> 軟件包 mysql-community-common.x86_64.0.5.7.30-1.el7 將被 安裝
---> 軟件包 mysql-community-libs.x86_64.0.5.7.30-1.el7 將被 安裝
---> 軟件包 mysql-community-server.x86_64.0.5.7.30-1.el7 將被 安裝
--> 解決依賴關系完成

依賴關系解決

=============================================================================================================================================================================================
 Package                                             架構                                版本                                       源                                                  大小
=============================================================================================================================================================================================
正在安裝:
 mysql-community-client                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                               25 M
 mysql-community-common                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              311 k
 mysql-community-libs                                x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              2.3 M
 mysql-community-server                              x86_64                              5.7.30-1.el7                               mysql57-community-dmr                              173 M

事務概要
=============================================================================================================================================================================================
安裝  4 軟件包

總下載量:201 M
安裝大小:875 M
Background downloading packages, then exiting:
No Presto metadata available for mysql57-community-dmr
警告:/song/mysql-community-libs-5.7.30-1.el7.x86_64.rpm.14686.tmp: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY                                       ] 224 kB/s | 2.3 MB  00:15:08 ETA 
mysql-community-libs-5.7.30-1.el7.x86_64.rpm.14686.tmp 的公鑰尚未安裝
(1/3): mysql-community-libs-5.7.30-1.el7.x86_64.rpm                                                                                                                   | 2.3 MB  00:00:11     
mysql-community-server-5.7.30- FAILED                                            7% [====-                                                                 ]  269 B/s |  14 MB 201:41:07 ETA 
http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-server-5.7.30-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在嘗試其它鏡像。
mysql-community-client-5.7.30- FAILED                                          
http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm: [Errno 12] Timeout on http://repo.mysql.com/yum/mysql-5.7-community/el/7/x86_64/mysql-community-client-5.7.30-1.el7.x86_64.rpm: (28, 'Operation too slow. Less than 1000 bytes/sec transferred the last 30 seconds')
正在嘗試其它鏡像。
(2/3): mysql-community-server-5.7.30-1.el7.x86_64.rpm                                                                                                                 | 173 MB  00:06:14     
(3/3): mysql-community-client-5.7.30-1.el7.x86_64.rpm                                                                                                                 |  25 MB  00:00:57     
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
總計                                                                                                                                                         421 kB/s | 201 MB  00:08:08     
exiting because "Download Only" specified

3:查看

 

 4:安裝mysql5.7.30的rpm文件

rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm 

安裝詳情如下

[root@localhost mysql5.7.30]# rpm -ivh mysql-community-common-5.7.30-1.el7.x86_64.rpm 
警告:mysql-community-common-5.7.30-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
准備中...                          ################################# [100%]
正在升級/安裝...
   1:mysql-community-common-5.7.30-1.e################################# [100%]
[root@localhost mysql5.7.30]# rpm -ivh mysql-community-libs-5.7.30-1.el7.x86_64.rpm 
警告:mysql-community-libs-5.7.30-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
准備中...                          ################################# [100%]
正在升級/安裝...
   1:mysql-community-libs-5.7.30-1.el7################################# [100%]
[root@localhost mysql5.7.30]# rpm -ivh mysql-community-client-5.7.30-1.el7.x86_64.rpm 
警告:mysql-community-client-5.7.30-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
准備中...                          ################################# [100%]
正在升級/安裝...
   1:mysql-community-client-5.7.30-1.e################################# [100%]
[root@localhost mysql5.7.30]# rpm -ivh mysql-community-server-5.7.30-1.el7.x86_64.rpm 
警告:mysql-community-server-5.7.30-1.el7.x86_64.rpm: 頭V3 DSA/SHA1 Signature, 密鑰 ID 5072e1f5: NOKEY
准備中...                          ################################# [100%]
正在升級/安裝...
   1:mysql-community-server-5.7.30-1.e################################# [100%]

安裝完進行 驗證 驗證前先查看mysql是否啟動 沒啟動的話先啟動mysql

 systemctl status mysqld.service
 systemctl start mysqld.service

查看初始的臨時密碼

[root@localhost mysql5.7.30]# cat /var/log/mysqld.log  | grep password
2020-08-12T13:35:12.703762Z 1 [Note] A temporary password is generated for root@localhost: m-n)tiX!9Tj)

臨時密碼登錄,並修改密碼

[root@localhost mysql5.7.30]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 Server version: 5.7.30

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> 
mysql> 
mysql> set global validate_password_policy=0;
Query OK, 0 rows affected (0.00 sec)

mysql> set global validate_password_length=1;
Query OK, 0 rows affected (0.00 sec)

mysql> alter user 'root'@'localhost' identified by '1234';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'zt_dev'@'%' IDENTIFIED BY '1234' WITH GRANT OPTION;
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql
> flush privileges -> ; Query OK, 0 rows affected (0.00 sec) mysql> exit

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM