AWS Lightsail Linux上的mySql 5.7安装问题

AWS Lightsail Linux上的mySql 5.7安装问题,linux,amazon-ec2,mysql-5.7,Linux,Amazon Ec2,Mysql 5.7,我试图在AWS Lightsail Amazon Linux上安装MySQL 5.7,但遇到错误。 这是悉尼A区最新的虚拟机,只支持操作系统的Linux/Unix蓝图。我不想在mysql中使用每个已安装的LAMP 我遵循了以下步骤 首先,我安装了最新的更新 sudo yum update -y 输出 当我尝试使用yum安装mysql时,默认情况下会显示mysql 5.5 ==============================================================

我试图在AWS Lightsail Amazon Linux上安装MySQL 5.7,但遇到错误。 这是悉尼A区最新的虚拟机,只支持操作系统的Linux/Unix蓝图。我不想在mysql中使用每个已安装的LAMP

我遵循了以下步骤

首先,我安装了最新的更新

sudo yum update -y
输出

当我尝试使用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 info-mysql显示了5.5版本

然后我下载并尝试从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
输出

安装了Repo,但当我尝试安装mysql社区服务器时,它显示了依赖项错误

sudo yum install mysql-community-server
输出

我已经用同样的方法在最新的Linux2 EC2 AMI上安装了MySQL 5.7


我通过SSH密钥对连接虚拟机,虚拟机不在静态实时IP上。请帮帮我,看看我错过了什么

首先,您需要了解lightsail Linux和最新EC2 Linux的区别。 最新的EC2Linux实例是LinuxAMI2,而lightsail Linux是LinuxAMI1

您可以在lightsail和EC2上看到下面命令的不同

lightsail Linux

cat/etc/os版本

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/"
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/"
EC2Linux

cat/etc/os版本

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/"
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/"
您可以通过以下步骤在最新的lightsail Linux上安装Mysql 5.7。问题之一可能是您必须通过安全模式设置密码。 首先删除任何现有的mysql内置组件(如果有)

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

sudo yum install mysql57 mysql57-server
见图

启动服务

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 -uroot -pPass@123
无密码启动

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 -uroot -pPass@123
连接Mysql外壳

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
现在您可以使用新密码连接

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 -uroot -pPass@123
请记住,还要将服务设置为重新启动时自动启动

sudo chkconfig mysqld on

享受吧

首先,您需要了解lightsail Linux和最新EC2 Linux的区别。 最新的EC2Linux实例是LinuxAMI2,而lightsail Linux是LinuxAMI1

您可以在lightsail和EC2上看到下面命令的不同

lightsail Linux

cat/etc/os版本

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/"
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/"
EC2Linux

cat/etc/os版本

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/"
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/"
您可以通过以下步骤在最新的lightsail Linux上安装Mysql 5.7。问题之一可能是您必须通过安全模式设置密码。 首先删除任何现有的mysql内置组件(如果有)

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

sudo yum install mysql57 mysql57-server
见图

启动服务

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 -uroot -pPass@123
无密码启动

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 -uroot -pPass@123
连接Mysql外壳

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
现在您可以使用新密码连接

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 -uroot -pPass@123
请记住,还要将服务设置为重新启动时自动启动

sudo chkconfig mysqld on

享受吧

谢谢Bajwa,是的,它成功了。看起来mysql57社区服务器版与lightsail linux不完全兼容,或者在安装依赖项问题后它可能会工作。谢谢Bajwa,是的,它工作了。看起来mysql57社区服务器版与lightsail linux不完全兼容,或者可能在安装依赖项后仍能正常工作。