CentOS7安裝MySQL Server

來源:互聯網
上載者:User

標籤:name   centos7   fas   server   open   roo   tun   選擇   system   

CentOS 7的預設YUM源中是MariaDB,而不是我們常用的MySQL。

本文將介紹如何通過YUM安裝MySQL。

  1. 首先下載Yum源的rpm包

具體地址在:

http://repo.mysql.com/

可以選擇自己需要的版本。

我下載的是:

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

  1. 安裝rpm檔案

通過命令,安裝MySQL的YUM源:

rpm -ivh mysql57-community-release-el7.rpm

可以在/etc/yum.repos.d中看到相關的repo檔案:

[[email protected] yum.repos.d]# ls

CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo mysql-community-source.repo

CentOS-CR.repo CentOS-fasttrack.repo CentOS-Sources.repo mysql-community.repo OpenLogic.repo

[[email protected] yum.repos.d]#

  1. YUM安裝MySQL

通過yum命令安裝:

yum install -y mysql-server

  1. 啟動MySQL

啟動:

Systemctl start mysqld

查看:

Systemctl status mysqld

設定開機啟動:

Systemctl enable mysqld

通過netstat查看:

[[email protected] yum.repos.d]# netstat -tunlp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name

tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd

tcp 0 0 0.0.0.0:53 0.0.0.0:* LISTEN 808/dnsmasq

tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 807/sshd

tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 909/master

tcp6 0 0 :::111 :::* LISTEN 1/systemd

tcp6 0 0 :::80 :::* LISTEN 1526/httpd

tcp6 0 0 :::53 :::* LISTEN 808/dnsmasq

tcp6 0 0 :::22 :::* LISTEN 807/sshd

tcp6 0 0 ::1:25 :::* LISTEN 909/master

tcp6 0 0 :::3306 :::* LISTEN 24276/mysqld

udp 0 0 127.0.0.1:323 0.0.0.0:* 498/chronyd

udp 0 0 0.0.0.0:617 0.0.0.0:* 12738/rpcbind

udp 0 0 0.0.0.0:40620 0.0.0.0:* 757/dhclient

udp 0 0 0.0.0.0:53 0.0.0.0:* 808/dnsmasq

udp 0 0 0.0.0.0:68 0.0.0.0:* 757/dhclient

udp 0 0 0.0.0.0:111 0.0.0.0:* 12738/rpcbind

udp6 0 0 ::1:323 :::* 498/chronyd

udp6 0 0 :::617 :::* 12738/rpcbind

udp6 0 0 :::40419 :::* 757/dhclient

udp6 0 0 :::53 :::* 808/dnsmasq

udp6 0 0 :::111 :::* 12738/rpcbind

可以看到3306連接埠。

CentOS7安裝MySQL Server

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.