---
category: help
layout: help
mirrorid: mysql
---

# MySQL 软件仓库镜像使用帮助

<form class="form-inline">
<div class="form-group">
	<label>是否使用 HTTPS</label>
	<select id="http-select" class="form-control content-select" data-target="#content-0,#content-1">
	  <option data-http_protocol="https://" selected>是</option>
	  <option data-http_protocol="http://">否</option>
	</select>
</div>
</form>


<form class="form-inline">
<div class="form-group">
	<label>是否使用 sudo</label>
	<select id="sudo-select" class="form-control content-select" data-target="#content-0,#content-1">
	  <option data-sudo="sudo " selected>是</option>
	  <option data-sudo="">否</option>
	</select>
</div>
</form>



### Debian/Ubuntu 用户

再选择你的 Debian/Ubuntu 版本，文本框中内容写进 `/etc/apt/sources.list.d/mysql-community.list`



<form class="form-inline">
<div class="form-group">
  <label>发行版：</label>
    <select id="select-0-0" class="form-control content-select" data-target="#content-0">
      <option data-os_name="debian" data-release_name="bullseye" selected>Debian 11</option>
      <option data-os_name="debian" data-release_name="buster">Debian 10</option>
      <option data-os_name="debian" data-release_name="stretch">Debian 9</option>
      <option data-os_name="debian" data-release_name="jessie">Debian 8</option>
      <option data-os_name="ubuntu" data-release_name="jammy">Ubuntu 22.04 LTS</option>
      <option data-os_name="ubuntu" data-release_name="focal">Ubuntu 20.04 LTS</option>
      <option data-os_name="ubuntu" data-release_name="bionic">Ubuntu 18.04 LTS</option>
      <option data-os_name="ubuntu" data-release_name="xenial">Ubuntu 16.04 LTS</option>
    </select>
</div>
</form>

<form class="form-inline">
<div class="form-group">
  <label>MySQL 版本号：</label>
    <select id="select-0-1" class="form-control content-select" data-target="#content-0">
      <option data-version="8.0" selected>8.0</option>
      <option data-version="5.7">5.7</option>
      <option data-version="5.6">5.6</option>
    </select>
</div>
</form>

{% raw %}
<script id="template-0" type="x-tmpl-markup">
deb {{http_protocol}}{{mirror}}/apt/{{os_name}} {{release_name}} mysql-{{version}} mysql-tools
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-0" data-template="#template-0" data-select="#http-select,#sudo-select,#select-0-0,#select-0-1">
</code>
</pre>


参考文档：https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/

### RHEL/CentOS 用户

新建 `/etc/yum.repos.d/mysql-community.repo`，内容如下：

注：`mysql-8.0`, `mysql-connectors`和`mysql-tools`在 RHEL 7/8上还提供了`aarch64`版本。




<form class="form-inline">
<div class="form-group">
  <label>发行版：</label>
    <select id="select-1-0" class="form-control content-select" data-target="#content-1">
      <option data-release_name="el7" selected>CentOS/RHEL 7</option>
    </select>
</div>
</form>

<form class="form-inline">
<div class="form-group">
  <label>MySQL 版本号：</label>
    <select id="select-1-1" class="form-control content-select" data-target="#content-1">
      <option data-version="8.0" selected>8.0</option>
      <option data-version="5.7">5.7</option>
      <option data-version="5.6">5.6</option>
    </select>
</div>
</form>

{% raw %}
<script id="template-1" type="x-tmpl-markup">
[mysql-connectors-community]
name=MySQL Connectors Community
baseurl={{http_protocol}}{{mirror}}/yum/mysql-connectors-community-{{release_name}}-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql

[mysql-tools-community]
name=MySQL Tools Community
baseurl={{http_protocol}}{{mirror}}/yum/mysql-tools-community-{{release_name}}-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql

[mysql-{{version}}-community]
name=MySQL {{version}} Community Server
baseurl={{http_protocol}}{{mirror}}/yum/mysql-{{version}}-community-{{release_name}}-$basearch/
enabled=1
gpgcheck=1
gpgkey=https://repo.mysql.com/RPM-GPG-KEY-mysql
</script>
{% endraw %}

<p></p>

<pre>
<code id="content-1" data-template="#template-1" data-select="#http-select,#sudo-select,#select-1-0,#select-1-1">
</code>
</pre>


参考文档：https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/

