Alibaba Cloud Linux安装mysql8

Alibaba Cloud Linux安装mysql8

安装

添加数据源

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm

安装

yum install mysql-community-server

如果报错

MySQL 8.0 Community Server                                                                                                                                   27 MB/s |  27 kB     00:00    
导入 GPG 公钥 0x5072E1F5:
 Userid: "MySQL Release Engineering "
 指纹: A4A9 4068 76FC BD3C 4567 70C8 8C71 8D3B 5072 E1F5
 来自: /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
确定吗?[y/N]: y
导入公钥成功
导入的密钥没有公钥,错误的公钥?
mysql-community-client-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-client-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
mysql-community-client-plugins-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-client-plugins-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
mysql-community-common-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-common-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
mysql-community-icu-data-files-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-icu-data-files-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
mysql-community-libs-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-libs-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
mysql-community-server-8.0.36-1.el7.x86_64.rpm 的公钥没有安装. 失败的软件包是:mysql-community-server-8.0.36-1.el7.x86_64
 GPG密钥配置为:file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql
下载的软件包保存在缓存中,直到下次成功执行事务。
您可以通过执行 'yum clean packages' 删除软件包缓存。
错误:GPG 检查失败

导入公钥后执行yum install mysql-community-server

rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2023

安装openssl

yum install compat-openssl10

启动mysql服务

systemctl start mysqld

获取默认密码

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

登录

mysql -u root -p

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'xxx';

开启远程登录

创建用户

create user 'qdcosin'@'%' identified with mysql_native_password by 'xxx';
grant all privileges on * .* to 'qdcosin'@'%';

然后尝试使用navicat测试远程登录

其它mysql命令

# 删除用户
DROP USER 'qdcosin'@'%';

你可能感兴趣的:(Linux,linux,服务器,mysql)