[AWS lightail Linux上的Msql 5.7安装问题

问题描述 投票:1回答:1

我正在尝试在AWS Lightsail Amazon Linux上安装Mysql 5.7,但遇到错误。这是位于悉尼A区的仅具有OS(Linux / Unix蓝图)的最新VM。我不想将已安装的LAMP与mysql一起使用。

我已按照以下步骤操作。

首先,我已经安装了最新更新。

sudo yum update -y

输出

Loaded plugins: priorities, update-motd, upgrade-helper
Resolving Dependencies
--> Running transaction check
---> Package ec2-net-utils.noarch 0:0.5-3.36.amzn1 will be updated
---> Package ec2-net-utils.noarch 0:0.6-1.1.amzn1 will be an update
---> Package ec2-utils.noarch 0:0.5-3.36.amzn1 will be updated
---> Package ec2-utils.noarch 0:0.6-1.1.amzn1 will be an update
---> Package kernel.x86_64 0:4.14.165-102.185.amzn1 will be installed
---> Package python27-pip.noarch 0:9.0.3-1.26.amzn1 will be updated
---> Package python27-pip.noarch 0:9.0.3-1.27.amzn1 will be an update
---> Package sudo.x86_64 0:1.8.6p3-29.28.amzn1 will be updated
---> Package sudo.x86_64 0:1.8.6p3-29.29.amzn1 will be an update
--> Finished Dependency Resolution

当我尝试用yum安装mysql时,默认情况下显示Mysql 5.5

============================================================================================================================================
 Package                          Arch                       Version                                 Repository                        Size
============================================================================================================================================
Installing:
 mysql                            noarch                     5.5-1.6.amzn1                           amzn-main                        2.7 k
Installing for dependencies:
 mysql-config                     x86_64                     5.5.62-1.23.amzn1                       amzn-updates                      49 k
 mysql55                          x86_64                     5.5.62-1.23.amzn1                       amzn-updates                     7.5 M
 mysql55-libs                     x86_64                     5.5.62-1.23.amzn1                       amzn-updates                     816 k
Transaction Summary
============================================================================================================================================

Yum使用yum info命令在现有软件包下面显示。

sudo yum info mysql

Loaded plugins: priorities, update-motd, upgrade-helper
Available Packages
Name        : mysql
Arch        : noarch
Version     : 5.5
Release     : 1.6.amzn1
Size        : 2.7 k
Repo        : amzn-main/latest
Summary     : MySQL meta package
URL         : http://www.mysql.com
License     : GPLv2 with exceptions
Description : MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
            : client/server implementation consisting of a server daemon (mysqld)
            : and many different client programs and libraries. The base package
            : contains the standard MySQL client programs and generic MySQL files.

然后我下载并尝试从rpm安装mysql 5.7。

sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

sudo yum localinstall mysql57-community-release-el7-11.noarch.rpm

输出

Dependencies Resolved

============================================================================================================================================
 Package                                Arch                Version             Repository                                             Size
============================================================================================================================================
Installing:
 mysql57-community-release              noarch              el7-11              /mysql57-community-release-el7-11.noarch               31 k

Transaction Summary
============================================================================================================================================

Installed:
  mysql57-community-release.noarch 0:el7-11

已安装回购协议,但是当我尝试安装mysql-community-server时,它显示依赖项错误。

sudo yum install mysql-community-server

输出

31 packages excluded due to repository priority protections
Resolving Dependencies
--> Running transaction check
---> Package mysql-community-server.x86_64 0:5.7.29-1.el7 will be installed
--> Processing Dependency: mysql-community-common(x86-64) = 5.7.29-1.el7 for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: mysql-community-client(x86-64) >= 5.7.9 for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: libsasl2.so.3()(64bit) for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-client.x86_64 0:5.7.29-1.el7 will be installed
--> Processing Dependency: mysql-community-libs(x86-64) >= 5.7.9 for package: mysql-community-client-5.7.29-1.el7.x86_64
---> Package mysql-community-common.x86_64 0:5.7.29-1.el7 will be installed
---> Package mysql-community-server.x86_64 0:5.7.29-1.el7 will be installed
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: libsasl2.so.3()(64bit) for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Running transaction check
---> Package mysql-community-libs.x86_64 0:5.7.29-1.el7 will be installed
---> Package mysql-community-server.x86_64 0:5.7.29-1.el7 will be installed
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: systemd for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Processing Dependency: libsasl2.so.3()(64bit) for package: mysql-community-server-5.7.29-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community)
           Requires: systemd
Error: Package: mysql-community-server-5.7.29-1.el7.x86_64 (mysql57-community)
           Requires: libsasl2.so.3()(64bit)
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

我已经以相同的方式在最新的Linux2 EC2 AMI上安装了Mysql 5.7。我正在通过SSH密钥对连接VM,并且VM不在Static LIVE IP上。请帮助我,看看我想念什么?

linux amazon-ec2 mysql-5.7
1个回答
1
投票

首先,您需要了解lightsail Linux和最新的EC2 Linux的区别。最新的EC2 Linux实例是Linux AMI2,而lightail Linux是Linux AMI1

您可能会在lightsailEC2上看到以下命令的区别。

lightsail Linux

cat / etc / os-release

NAME="Amazon Linux AMI"
VERSION="2018.03"
ID="amzn"
ID_LIKE="rhel fedora"
VERSION_ID="2018.03"
PRETTY_NAME="Amazon Linux AMI 2018.03"
ANSI_COLOR="0;33"
CPE_NAME="cpe:/o:amazon:linux:2018.03:ga"
HOME_URL="http://aws.amazon.com/amazon-linux-ami/"

[EC2 Linux

cat / etc / os-release

NAME="Amazon Linux"
VERSION="2"
ID="amzn"
ID_LIKE="centos rhel fedora"
VERSION_ID="2"
PRETTY_NAME="Amazon Linux 2"
ANSI_COLOR="0;33"
CPE_NAME="cpe:2.3:o:amazon:amazon_linux:2"
HOME_URL="https://amazonlinux.com/"

您可以按照以下步骤在最新的lightail Linux上安装Mysql 5.7。问题之一可能是您必须通过安全模式设置密码。首先删除所有现有的mysql嵌入的组件(如果有)。

然后按照以下步骤安装mysql 5.7。

sudo yum install mysql57 mysql57-server

参见图片enter image description here

启动服务

sudo service mysqld start

使用空密码连接或从mysql日志中找到临时密码。

cat /var/log/mysqld.log | grep "temporary password"

如果未使用空密码连接,并且mysql日志中没有临时密码,则在安全模式下设置密码。

这里是设置密码的步骤。

sudo service mysqld stop

没有密码开始。

sudo mysqld_safe --skip-grant-tables &


2020-02-08T07:36:00.286533Z mysqld_safe Logging to '/var/log/mysqld.log'.
2020-02-08T07:36:00.305112Z mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

连接Mysql Shell

mysql -uroot

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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>

在mysql Shell中运行以下命令。

use mysql;

update user set authentication_string=PASSWORD("Pass@123") where User='root';

flush privileges;
exit

现在重新启动服务

sudo service mysqld restart

2020-02-08T07:38:51.498523Z mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
Stopping mysqld:                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[1]+  Done                    sudo mysqld_safe --skip-grant-tables

现在您可以使用新密码连接。

mysql -uroot -pPass@123

请记住,还将服务设置为在重新启动时自动启动。

sudo chkconfig mysqld on

享受!

© www.soinside.com 2019 - 2024. All rights reserved.