Amazon CentOS 7 AMI安裝MySQL5.6資料庫方法

來源:互聯網
上載者:User

centos使用者登入到Amazon EC2伺服器以後,sudo到root使用者。

在CentOS7 AMI執行yum install mysql-server命令會發現無法安裝mysql server。

# sudo su -
# yum install mysql-server
Loaded plugins: fastestmirror
base                                                     | 3.6 kB     00:00
epel/x86_64/metalink                                     | 5.5 kB     00:00
epel                                                     | 4.4 kB     00:00
extras                                                   | 3.4 kB     00:00
rpmforge                                                 | 1.9 kB     00:00
updates                                                  | 3.4 kB     00:00
epel/x86_64/primary_db                                     | 3.8 MB   00:00
(1/2): epel/x86_64/updateinfo                              | 230 kB   00:00
(2/2): epel/x86_64/pkgtags                                 | 1.3 MB   00:00
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: s3-mirror-ap-northeast-1.fedoraproject.org
 * extras: www.ftp.ne.jp
 * rpmforge: ftp.riken.jp
 * updates: www.ftp.ne.jp
No package mysql-server available.
Error: Nothing to do

因為,CentOS7的預設資料庫是MariaDB。

1, 配置MySQL5.6的Repository

訪問http://www.mysql.com/downloads/以後,點擊「Downloads」→「Yum Repository」。

選擇Red Hat Enterprise Linux 7 / Oracle Linux 7 (Architecture Independent), RPM Package的「Download」



在這裡會顯示登入Oracle的頁面,但是不必登入,拷貝No thanks, just start my download.的連結就可以。

拷貝的連結是:http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

配置MySQL5.6的yum源。

# rpm -ivh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Retrieving http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-release-el7-5    ################################# [100%]

確認MySQL5.6yum源存在。

# yum repolist
Loaded plugins: fastestmirror
mysql-connectors-community                               | 2.5 kB     00:00
mysql-tools-community                                    | 2.5 kB     00:00
mysql56-community                                        | 2.5 kB     00:00
(1/3): mysql-connectors-community/x86_64/primary_db        | 7.0 kB   00:00
(2/3): mysql-tools-community/x86_64/primary_db             |  11 kB   00:00
(3/3): mysql56-community/x86_64/primary_db                 |  59 kB   00:00
Loading mirror speeds from cached hostfile
 * base: www.ftp.ne.jp
 * epel: ftp.jaist.ac.jp
 * extras: www.ftp.ne.jp
 * rpmforge: ftp.riken.jp
 * updates: www.ftp.ne.jp
repo id                           repo name                               status
base/7/x86_64                     CentOS-7 - Base                         8,465
epel/x86_64                       Extra Packages for Enterprise Linux 7 - 6,912
extras/7/x86_64                   CentOS-7 - Extras                         102
mysql-connectors-community/x86_64 MySQL Connectors Community                 12
mysql-tools-community/x86_64      MySQL Tools Community                      12
mysql56-community/x86_64          MySQL 5.6 Community Server                 94
rpmforge                          RHEL 7 - RPMforge.net - dag               245
updates/7/x86_64                  CentOS-7 - Updates                      1,497
repolist: 17,339

2, 安裝MySQL

# yum install mysql-server

# mysql --version
mysql  Ver 14.14 Distrib 5.6.22, for Linux (x86_64) using  EditLine wrapper
成功的在Amazon CentOS7 AMI上安裝了MySQL5.6.22。

小結

CentOS7,好像有不少改變呀。好像service命令變為systemctl命令了。

# service mysqld stop
Redirecting to /bin/systemctl stop  mysqld.service

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.