欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

Linux系統(tǒng)下怎么安裝mysql

這篇文章給大家分享的是有關(guān)Linux系統(tǒng)下怎么安裝MySQL的內(nèi)容。小編覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨小編過(guò)來(lái)看看吧。

成都創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站建設(shè)、做網(wǎng)站與策劃設(shè)計(jì),綠園網(wǎng)站建設(shè)哪家好?成都創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:綠園等地區(qū)。綠園做網(wǎng)站價(jià)格咨詢:18980820575

1.查看linux操作系統(tǒng)版本和系統(tǒng)內(nèi)核版本

 [root@nfs_client ~]# cat /etc/redhat-release     查看操作系統(tǒng)版本
CentOS Linux release 7.5.1804 (Core) 
[root@nfs_client ~]# uname -r               查看系統(tǒng)內(nèi)核版本
3.10.0-862.el7.x86_64

二 下載對(duì)應(yīng)版本的MySQL 安裝文件

 1.下載地址:https://dev.mysql.com/downloads/mysql/

Linux系統(tǒng)下怎么安裝mysql

下載下來(lái):

Linux系統(tǒng)下怎么安裝mysql

Linux系統(tǒng)下怎么安裝mysql

三 卸載舊版本的MySql (沒(méi)有的話,則跳過(guò)此步驟)
      1、查看舊版本MySql
      rpm -qa | grep mysql

      將會(huì)列出舊版本MySql的組件列表,如:

            我的電腦這里只顯示一個(gè),有可能會(huì)有多個(gè)。

      2、逐個(gè)刪除掉舊的組件
      使用命令rpm -e --nodeps {-file-name}進(jìn)行移除操作,移除的時(shí)候可能會(huì)有依賴,要注意一定的順序。

            第一次沒(méi)有刪除成功是因?yàn)樽詈蠖嗔艘粋€(gè)空格。

四、安裝過(guò)程:

解壓tar文件

命令:

tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar

執(zhí)行結(jié)果:

[root@localhost software]# 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

安裝依賴組件

在我進(jìn)行安裝msql-community-server-xxx的時(shí)候出現(xiàn)了下面的問(wèn)題

[root@localhost software]# 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:
        /usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(Getopt::Long) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(strict) is needed by mysql-community-server-5.7.19-1.el7.x86_64
[root@localhost software]#

由上面的錯(cuò)誤可以看出我們需要安裝相應(yīng)的依賴

  1. libaio

  2. net-tools

  3. perl

  • 安裝依賴

yum -y install libaio
yum -y install net-tools
yum -y install perl

安裝mysql組件

經(jīng)過(guò)上面的解壓操作,我們得到了很多rpm文件。但是我們不需要這么多,我們只需要安裝一下四個(gè)組件就可以了

mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-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

因?yàn)榫哂?strong>依賴關(guān)系,所以我們需要按順序執(zhí)行。
rpm -ivh 文件名就能安裝相應(yīng)的組件。
在執(zhí)行server的時(shí)候,需要依賴安裝一些工具組件,已經(jīng)在上文有說(shuō)明了

安裝命令:

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

執(zhí)行過(guò)程:

root@localhost software]# 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 software]# 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 software]# 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 software]# 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%]

啟動(dòng)數(shù)據(jù)庫(kù)

  •  

×

廣告

MySQL5.7 安裝 - Linux下RPM方式安裝

Linux系統(tǒng)下怎么安裝mysql 番薯IT 關(guān)注

 0.1 2017.09.09 16:19* 字?jǐn)?shù) 623 閱讀 1557評(píng)論 1喜歡 1

目前MySQL5.7的最新版本是5.7.19,

下載

  • 地址:https://dev.mysql.com/downloads/mysql/

  • 名稱:mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar

安裝

我已經(jīng)把安裝包放到/usr/local/software路徑下面

[root@localhost software]# ls
mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar

查看是否已經(jīng)安裝mysql

rpm -qa | grep mysql

解壓tar文件

  • 命令

tar -xvf mysql-5.7.19-1.el7.x86_64.rpm-bundle.tar
  • 執(zhí)行結(jié)果

[root@localhost software]# 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

卸載沖突的RPM組件

在我們安裝mysql相關(guān)組件的時(shí)候,如果不將此沖突的組件刪除掉,我們是安裝不成功的。
我們可以先跳過(guò)這步,直接進(jìn)入下步操作,在安裝的過(guò)程中會(huì)有相應(yīng)的提示。下面是我所碰到的一個(gè)提示:

# 安裝mysql組件時(shí)出現(xiàn)的依賴錯(cuò)誤
error: Failed dependencies:
        mysql-community-common(x86-64) >= 5.7.9 is needed by mysql-community-libs-5.7.19-1.el7.x86_64
        mariadb-libs is obsoleted by mysql-community-libs-5.7.19-1.el7.x86_64
        
# 卸載mariadb-libs時(shí)出現(xiàn)的依賴錯(cuò)誤
error: Failed dependencies:
        libmysqlclient.so.18()(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64
        libmysqlclient.so.18(libmysqlclient_18)(64bit) is needed by (installed) postfix-2:2.10.1-6.el7.x86_64

可以看出,我們需要卸載postfixmariadb-libs相關(guān)的組件。卸載我們可以使用rpm -ev xxx

  • 查看postfixmariadb-libs

rpm -qa | grep postfix
rpm -qa | grep mariadb
  • 執(zhí)行過(guò)程

[root@localhost software]# rpm -qa | grep postfix
postfix-2.10.1-6.el7.x86_64

[root@localhost software]# rpm -qa | grep mariadb
mariadb-libs-5.5.52-1.el7.x86_64
  • 卸載postfixmariadb-libs

rpm -ev postfix-2.10.1-6.el7.x86_64
rpm -ev mariadb-libs-5.5.52-1.el7.x86_64
  • 執(zhí)行過(guò)程

[root@localhost software]# rpm -ev postfix-2.10.1-6.el7.x86_64
Preparing packages...
postfix-2:2.10.1-6.el7.x86_64
[root@localhost software]# rpm -ev mariadb-libs-5.5.52-1.el7.x86_64
Preparing packages...
mariadb-libs-1:5.5.52-1.el7.x86_64

安裝依賴組件

在我進(jìn)行安裝msql-community-server-xxx的時(shí)候出現(xiàn)了下面的問(wèn)題

[root@localhost software]# 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:
        /usr/bin/perl is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1()(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        net-tools is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(Getopt::Long) is needed by mysql-community-server-5.7.19-1.el7.x86_64
        perl(strict) is needed by mysql-community-server-5.7.19-1.el7.x86_64
[root@localhost software]#

由上面的錯(cuò)誤可以看出我們需要安裝相應(yīng)的依賴

  1. libaio

  2. net-tools

  3. perl

  • 安裝依賴

yum -y install libaio
yum -y install net-tools
yum -y install perl

安裝mysql組件

經(jīng)過(guò)上面的解壓操作,我們得到了很多rpm文件。但是我們不需要這么多,我們只需要安裝一下四個(gè)組件就可以了:

mysql-community-common-5.7.19-1.el7.x86_64.rpm
mysql-community-libs-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

因?yàn)榫哂?strong>依賴關(guān)系,所以我們需要按順序執(zhí)行。
rpm -ivh 文件名就能安裝相應(yīng)的組件。
在執(zhí)行server的時(shí)候,需要依賴安裝一些工具組件,已經(jīng)在上文有說(shuō)明了

  • 安裝命令

rpm -ivh mysql-community-common-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.19-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.19-1.el7.x86_64.rpm
  • 執(zhí)行過(guò)程

[root@localhost software]# 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 software]# 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 software]# 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 software]# 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%]

啟動(dòng)數(shù)據(jù)庫(kù)

# 查看mysql是否啟動(dòng)
service mysqld status

# 啟動(dòng)mysql
service mysqld start

# 停止mysql
service mysqld stop

# 重啟mysql
service mysqld restart

修改密碼

mysql安裝完成之后我們是沒(méi)有設(shè)置密碼的,但是mysql為我們?cè)O(shè)置了一個(gè)臨時(shí)的密碼,我們可以查看mysql的日志知道這個(gè)臨時(shí)密碼。

  • 查看臨時(shí)密碼

  •  

grep password /var/log/mysqld.log
  • 執(zhí)行過(guò)程

[root@localhost ~]# grep password /var/log/mysqld.log 
2017-09-01T16:43:10.889769Z 1 [Note] A temporary password is generated for root@localhost: hcLMTxbOh3?w

這樣我們得知臨時(shí)密碼是:hcLMTxbOh3?w
然后我們用這個(gè)臨時(shí)密碼登錄數(shù)據(jù)庫(kù)。

數(shù)據(jù)庫(kù)的密碼需要滿足以下條件:大小寫(xiě)字母,數(shù)字和特殊符號(hào)

  • 執(zhí)行命令

  • # 登錄mysql,之后需要輸入密碼
    mysql -p
    
    # 設(shè)置新密碼
    set password = password("Mysql_123456");
    
    # 退出當(dāng)前登錄
    quit;

    執(zhí)行過(guò)程:

  • [root@localhost ~]# mysql -p
    Enter password: 
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 6
    Server version: 5.7.19 MySQL Community Server (GPL)
    
    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> set password = password("Mysql_123456");
    Query OK, 0 rows affected, 1 warning (0.00 sec)
    
    mysql> quit;

    重新登錄,這樣我們就能用新的密碼登錄了。我們可以愉快的進(jìn)行數(shù)據(jù)庫(kù)操作了。

感謝各位的閱讀!關(guān)于“Linux系統(tǒng)下怎么安裝mysql”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,讓大家可以學(xué)到更多知識(shí),如果覺(jué)得文章不錯(cuò),可以把它分享出去讓更多的人看到吧!

分享題目:Linux系統(tǒng)下怎么安裝mysql
URL鏈接:http://chinadenli.net/article12/pijsdc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站面包屑導(dǎo)航外貿(mào)網(wǎng)站建設(shè)、標(biāo)簽優(yōu)化、域名注冊(cè)、全網(wǎng)營(yíng)銷推廣

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營(yíng)