amazon linux 2 ami - aws - 如何在 Amazon Linux 2 中安装 mysql?

amazon linux 2 ami - aws - 如何在 Amazon Linux 2 中安装 mysql?

我正在尝试在 amazon linux 2 ami 中安装 mysql,但无法做到。

sudo yum install mysql56-server -> doesn't work
amazon-linux-extras list -> doesn't list mysql

我不想要 mariadb,因为我对 mysql 有更多的了解(即使两者相同)

答案1

我自己找到了答案。请按照以下步骤操作:

sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
sudo yum localinstall mysql57-community-release-el7-11.noarch.rpm 
sudo yum install mysql-community-server
systemctl start mysqld.service

关键是添加源存储库然后安装,因为 Amazon Linux 2 尚未有默认存储库。

答案2

亚马逊的文档似乎建议使用 MariaDB(MySQL 的一个分支)。安装方法:

sudo yum -y install mariadb-server
sudo service mariadb start

答案3

我已经在 Amazon Linux 2 上安装了 MySQL

以下是命令

在 Amazon Linux 2 中安装 MySQL 服务器

sudo yum update -y 

sudo yum install -y mariadb-server

sudo systemctl enable mariadb

sudo systemctl start mariadb

sudo mysql_secure_installation

我已经在这里制作了一个关于此的视频

https://www.youtube.com/watch?v=h6sdw6wWNbY

答案4

对于需要 mysqldump 的人(例如,用于 ec2 上的 Wordpress),请从本机 amzn2-core repo 安装 mariadb。

   yum install mariadb.x86_64
   mysqldump -v

有关包裹的信息:

# yum info mariadb.x86_64
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Installed Packages
Name        : mariadb
Arch        : x86_64
Epoch       : 1
Version     : 5.5.68
Release     : 1.amzn2
Size        : 49 M
Repo        : installed
From repo   : amzn2-core
Summary     : A community developed branch of MySQL
URL         : http://mariadb.org
License     : GPLv2 with exceptions and LGPLv2 and BSD
Description : MariaDB is a community developed branch of MySQL.
        : MariaDB is a multi-user, multi-threaded SQL database server.
        : It is a client/server implementation consisting of a server daemon           (mysqld)
        : and many different client programs and libraries. The base package
        : contains the standard MariaDB/MySQL client programs and generic MySQL files.

相关内容