日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

CentOS 7.6 安装 Mysql 5.7

發布時間:2025/5/22 数据库 34 如意码农
生活随笔 收集整理的這篇文章主要介紹了 CentOS 7.6 安装 Mysql 5.7 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

一、查看CentOS版本

Mysql的版本必須要和CentOS的版本對應!查看CentOS版本的指令如下:

cat /etc/redhat-release

二、下載yum源包

wget http://repo.mysql.com/mysql57-community-release-el7.rpm

三、安裝rpm包

sudo rpm -Uvh mysql57-community-release-el7.rpm

四、安裝Mysql服務

[root@lanxinmeichen0613 mysql]# sudo yum install mysql-community-server
Loaded plugins: fastestmirror, versionlock
Determining fastest mirrors
base | 3.6 kB 00:00:00
extras | 2.9 kB 00:00:00
mysql-connectors-community | 2.6 kB 00:00:00
mysql-tools-community | 2.6 kB 00:00:00
mysql57-community | 2.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/7): base/7/x86_64/group_gz | 153 kB 00:00:00
(2/7): extras/7/x86_64/primary_db | 253 kB 00:00:00
(3/7): mysql-tools-community/x86_64/primary_db | 98 kB 00:00:00
(4/7): mysql-connectors-community/x86_64/primary_db | 114 kB 00:00:00
(5/7): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(6/7): updates/7/x86_64/primary_db | 27 MB 00:00:00
(7/7): mysql57-community/x86_64/primary_db | 361 kB 00:00:00
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.44-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.44-1.el7 for package: mysql-community-server-5.7.44-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.44-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.44-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.44-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.44-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.44-1.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
mysql-community-server x86_64 5.7.44-1.el7 mysql57-community 184 M
Installing for dependencies:
mysql-community-client x86_64 5.7.44-1.el7 mysql57-community 31 M
mysql-community-common x86_64 5.7.44-1.el7 mysql57-community 313 k
mysql-community-libs x86_64 5.7.44-1.el7 mysql57-community 3.0 M Transaction Summary
====================================================================================================================================
Install 1 Package (+3 Dependent packages) Total download size: 219 M
Installed size: 930 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/mysql57-community/packages/mysql-community-common-5.7.44-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Public key for mysql-community-common-5.7.44-1.el7.x86_64.rpm is not installed
(1/4): mysql-community-common-5.7.44-1.el7.x86_64.rpm | 313 kB 00:00:00
(2/4): mysql-community-libs-5.7.44-1.el7.x86_64.rpm | 3.0 MB 00:00:00
(3/4): mysql-community-client-5.7.44-1.el7.x86_64.rpm | 31 MB 00:00:04
(4/4): mysql-community-server-5.7.44-1.el7.x86_64.rpm | 184 MB 00:00:18
------------------------------------------------------------------------------------------------------------------------------------
Total 11 MB/s | 219 MB 00:00:19
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-11.noarch (installed)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
Is this ok [y/N]: y Public key for mysql-community-server-5.7.44-1.el7.x86_64.rpm is not installed Failing package is: mysql-community-server-5.7.44-1.el7.x86_64
GPG Keys are configured as: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

五、處理一下報錯

[root@lanxinmeichen0613 mysql]# sudo rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

六、繼續安裝Mysql服務

[root@lanxinmeichen0613 mysql]# sudo yum install -y mysql-community-server
Loaded plugins: fastestmirror, versionlock
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.44-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.44-1.el7 for package: mysql-community-server-5.7.44-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.44-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.44-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.44-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.44-1.el7 will be installed
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.44-1.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved ====================================================================================================================================
Package Arch Version Repository Size
====================================================================================================================================
Installing:
mysql-community-server x86_64 5.7.44-1.el7 mysql57-community 184 M
Installing for dependencies:
mysql-community-client x86_64 5.7.44-1.el7 mysql57-community 31 M
mysql-community-common x86_64 5.7.44-1.el7 mysql57-community 313 k
mysql-community-libs x86_64 5.7.44-1.el7 mysql57-community 3.0 M Transaction Summary
====================================================================================================================================
Install 1 Package (+3 Dependent packages) Total size: 219 M
Installed size: 930 M
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
Installing : mysql-community-common-5.7.44-1.el7.x86_64 1/4
Installing : mysql-community-libs-5.7.44-1.el7.x86_64 2/4
Installing : mysql-community-client-5.7.44-1.el7.x86_64 3/4
Installing : mysql-community-server-5.7.44-1.el7.x86_64 4/4
Verifying : mysql-community-server-5.7.44-1.el7.x86_64 1/4
Verifying : mysql-community-client-5.7.44-1.el7.x86_64 2/4
Verifying : mysql-community-libs-5.7.44-1.el7.x86_64 3/4
Verifying : mysql-community-common-5.7.44-1.el7.x86_64 4/4 Installed:
mysql-community-server.x86_64 0:5.7.44-1.el7 Dependency Installed:
mysql-community-client.x86_64 0:5.7.44-1.el7 mysql-community-common.x86_64 0:5.7.44-1.el7
mysql-community-libs.x86_64 0:5.7.44-1.el7 Complete!

七、啟動Mysql服務

[root@lanxinmeichen0613 mysql]# systemctl start mysqld.service

八、獲取臨時密碼

[root@lanxinmeichen0613 mysql]# sudo grep 'temporary password' /var/log/mysqld.log
2024-06-14T09:00:04.412228Z 1 [Note] A temporary password is generated for root@localhost: _izgQQt_7/OG

九、修改密碼

ALTER USER 'root'@'localhost' IDENTIFIED BY 'f21des';

十、修改遠程

mysql> CREATE USER 'root'@'%' IDENTIFIED BY '21des';
Query OK, 0 rows affected (0.00 sec) mysql> GRANT ALL ON *.* TO 'root'@'%';
Query OK, 0 rows affected (0.00 sec) mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)

總結

以上是生活随笔為你收集整理的CentOS 7.6 安装 Mysql 5.7的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。