centos7安裝mysql5.7實例分析
下載安裝mysql
下載rpm安裝套件
wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm --2022-01-22 03:01:53-- http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm Resolving dev.mysql.com (dev.mysql.com)... 137.254.60.11 Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:80... connected. HTTP request sent, awaiting response... 301 Moved Permanently Location: https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm [following] --2022-01-22 03:01:54-- https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm Connecting to dev.mysql.com (dev.mysql.com)|137.254.60.11|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm [following] --2022-01-22 03:01:55-- https://repo.mysql.com//mysql57-community-release-el7-8.noarch.rpm Resolving repo.mysql.com (repo.mysql.com)... 23.36.253.13 Connecting to repo.mysql.com (repo.mysql.com)|23.36.253.13|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 9116 (8.9K) [application/x-redhat-package-manager] Saving to: ‘mysql57-community-release-el7-8.noarch.rpm' 100%[=========================================================================================================================================================================>] 9,116 --.-K/s in 0s 2022-01-22 03:01:55 (249 MB/s) - ‘mysql57-community-release-el7-8.noarch.rpm' saved [9116/9116]
安裝
yum localinstall mysql57-community-release-el7-8.noarch.rpm
(py3) [root@localhost opt]# yum localinstall mysql57-community-release-el7-8.noarch.rpm Loaded plugins: fastestmirror, langpacks Examining mysql57-community-release-el7-8.noarch.rpm: mysql57-community-release-el7-8.noarch Marking mysql57-community-release-el7-8.noarch.rpm to be installed Resolving Dependencies --> Running transaction check ---> Package mysql57-community-release.noarch 0:el7-8 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================================================================================== Installing: mysql57-community-release noarch el7-8 /mysql57-community-release-el7-8.noarch 8.2 k Transaction Summary =================================================================================================================================================================================================================== Install 1 Package Total size: 8.2 k Installed size: 8.2 k Is this ok [y/d/N]: y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : mysql57-community-release-el7-8.noarch 1/1 Verifying : mysql57-community-release-el7-8.noarch 1/1 Installed: mysql57-community-release.noarch 0:el7-8 Complete!
查看安裝情況
(py3) [root@localhost opt]# yum repolist enabled | grep "mysql.*-community.*" mysql-connectors-community/x86_64 MySQL Connectors Community 167 mysql-tools-community/x86_64 MySQL Tools Community 82 mysql57-community/x86_64 MySQL 5.7 Community Server 564
安裝server
yum -y install mysql-community-server
(py3) [root@localhost opt]# yum -y install mysql-community-server Loaded plugins: 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 Resolving Dependencies --> Running transaction check ---> Package mysql-community-server.x86_64 0:5.7.37-1.el7 will be installed --> Processing Dependency: mysql-community-common(x86-64) = 5.7.37-1.el7 for package: mysql-community-server-5.7.37-1.el7.x86_64 --> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.37-1.el7.x86_64 --> Running transaction check ---> Package mysql-community-client.x86_64 0:5.7.37-1.el7 will be installed --> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.37-1.el7.x86_64 ---> Package mysql-community-common.x86_64 0:5.7.37-1.el7 will be installed --> Running transaction check ---> Package mysql-community-libs.x86_64 0:5.7.37-1.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved =================================================================================================================================================================================================================== Package Arch Version Repository Size =================================================================================================================================================================================================================== Installing: mysql-community-server x86_64 5.7.37-1.el7 mysql57-community 174 M Installing for dependencies: mysql-community-client x86_64 5.7.37-1.el7 mysql57-community 25 M mysql-community-common x86_64 5.7.37-1.el7 mysql57-community 311 k mysql-community-libs x86_64 5.7.37-1.el7 mysql57-community 2.4 M Transaction Summary =================================================================================================================================================================================================================== Install 1 Package (+3 Dependent packages) Total download size: 202 M Installed size: 878 M Downloading packages: warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.37-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY ] 0.0 B/s | 767 kB --:--:-- ETA Public key for mysql-community-common-5.7.37-1.el7.x86_64.rpm is not installed (1/4): mysql-community-common-5.7.37-1.el7.x86_64.rpm | 311 kB 00:00:00 (2/4): mysql-community-libs-5.7.37-1.el7.x86_64.rpm | 2.4 MB 00:00:04 (3/4): mysql-community-client-5.7.37-1.el7.x86_64.rpm | 25 MB 00:01:01 (4/4): mysql-community-server-5.7.37-1.el7.x86_64.rpm | 174 MB 00:03:40 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 917 kB/s | 202 MB 00:03:45 Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Importing GPG key 0x5072E1F5: Userid : "MySQL Release Engineering <mysql-build@oss.oracle.com>" Fingerprint: a4a9 4068 76fc bd3c 4567 70c8 8c71 8d3b 5072 e1f5 Package : mysql57-community-release-el7-8.noarch (@/mysql57-community-release-el7-8.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql Public key for mysql-community-server-5.7.37-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-server-5.7.37-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
這裡發現這個問題:
Public key for mysql-community-server-5.7.37-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-server-5.7.37-1.el7.x86_64 GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
備註:
由於MySQL在CentOS7中收費了,所以已經不支援MySQL了,取而代之在CentOS7內部整合了mariadb,而安裝MySQL的話會和MariaDB的文件衝突。
如果安裝的話,需要卸載MariaDB,另外也要注意安裝正確的安裝包,以及安裝順序。
以上是centos7安裝mysql5.7實例分析的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

AI Hentai Generator
免費產生 AI 無盡。

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

熱門話題

MySQL 數據庫中,用戶和數據庫的關係通過權限和表定義。用戶擁有用戶名和密碼,用於訪問數據庫。權限通過 GRANT 命令授予,而表由 CREATE TABLE 命令創建。要建立用戶和數據庫之間的關係,需創建數據庫、創建用戶,然後授予權限。

MySQL 有免費的社區版和收費的企業版。社區版可免費使用和修改,但支持有限,適合穩定性要求不高、技術能力強的應用。企業版提供全面商業支持,適合需要穩定可靠、高性能數據庫且願意為支持買單的應用。選擇版本時考慮的因素包括應用關鍵性、預算和技術技能。沒有完美的選項,只有最合適的方案,需根據具體情況謹慎選擇。

數據集成簡化:AmazonRDSMySQL與Redshift的零ETL集成高效的數據集成是數據驅動型組織的核心。傳統的ETL(提取、轉換、加載)流程複雜且耗時,尤其是在將數據庫(例如AmazonRDSMySQL)與數據倉庫(例如Redshift)集成時。然而,AWS提供的零ETL集成方案徹底改變了這一現狀,為從RDSMySQL到Redshift的數據遷移提供了簡化、近乎實時的解決方案。本文將深入探討RDSMySQL零ETL與Redshift集成,闡述其工作原理以及為數據工程師和開發者帶來的優勢。

要填寫 MySQL 用戶名和密碼,請:1. 確定用戶名和密碼;2. 連接到數據庫;3. 使用用戶名和密碼執行查詢和命令。

1.使用正確的索引索引通過減少掃描的數據量來加速數據檢索select*fromemployeeswherelast_name='smith';如果多次查詢表的某一列,則為該列創建索引如果您或您的應用根據條件需要來自多個列的數據,則創建複合索引2.避免選擇*僅選擇那些需要的列,如果您選擇所有不需要的列,這只會消耗更多的服務器內存並導致服務器在高負載或頻率時間下變慢例如,您的表包含諸如created_at和updated_at以及時間戳之類的列,然後避免選擇*,因為它們在正常情況下不需要低效查詢se

MySQL數據庫性能優化指南在資源密集型應用中,MySQL數據庫扮演著至關重要的角色,負責管理海量事務。然而,隨著應用規模的擴大,數據庫性能瓶頸往往成為製約因素。本文將探討一系列行之有效的MySQL性能優化策略,確保您的應用在高負載下依然保持高效響應。我們將結合實際案例,深入講解索引、查詢優化、數據庫設計以及緩存等關鍵技術。 1.數據庫架構設計優化合理的數據庫架構是MySQL性能優化的基石。以下是一些核心原則:選擇合適的數據類型選擇最小的、符合需求的數據類型,既能節省存儲空間,又能提升數據處理速度

MySQL 中的複制粘貼包含以下步驟:選擇數據,使用 Ctrl C(Windows)或 Cmd C(Mac)複製;在目標位置右鍵單擊,選擇“粘貼”或使用 Ctrl V(Windows)或 Cmd V(Mac);複製的數據將插入到目標位置,或替換現有數據(取決於目標位置是否已存在數據)。

通過以下命令查看 MySQL 數據庫:連接到服務器:mysql -u 用戶名 -p 密碼運行 SHOW DATABASES; 命令獲取所有現有數據庫選擇數據庫:USE 數據庫名;查看表:SHOW TABLES;查看表結構:DESCRIBE 表名;查看數據:SELECT * FROM 表名;
