Mysql开发实践:error while loading shared libraries: libaio解决方案

时间:2022-10-08 17:14:15
摘要:Mysql出现问题:error while loading shared libraries: libaio解决方案。

本文分享自华为云社区《Mysql出现问题:error while loading shared libraries: libaio解决方案》,作者: 小虚竹。

问题

初始化数据库时

mysqld --initialize --user mysql

Mysql开发实践:error while loading shared libraries: libaio解决方案

报错:

mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory

执行这行命令报错了,原因是:新的服务器环境,上面很多依赖都没有,所以安装软件的时候遇到一大堆小问题,解决它很简单,它缺少啥就安装啥。

解决方案

yum install -y libaio.so.1

Mysql开发实践:error while loading shared libraries: libaio解决方案

又报错了:

Errors during downloading metadata for repository ‘epel’:
Status code: 404 for http://archives.fedoraproject.org/pub/archive/epel/8/Everything/x86_64/repodata/repomd.xml (IP: **)
Error: Failed to download metadata for repo ‘epel’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

原因是:第三方的镜像站中均已移除CentOS 8的源,Centos 8版本已停止更新相应依赖导致的,下载新的yum源即可搞定。

解决方案:备份之前的repo文件,命令:

mv /etc/yum.repos.d /etc/yum.repos.d.bak

创建源文件目录,命令:

mkdir -p /etc/yum.repos.d

下载新的yum源

curl https://mirrors.aliyun.com/repo/Centos-vault-8.5.2111.repo > /etc/yum.repos.d/Centos-vault-8.5.2111.repo
curl https://mirrors.aliyun.com/repo/epel-archive-8.repo > /etc/yum.repos.d/epel-archive-8.repo

如图所示操作:

Mysql开发实践:error while loading shared libraries: libaio解决方案

再下载依赖:

yum install -y libaio.so.1

Mysql开发实践:error while loading shared libraries: libaio解决方案

Mysql开发实践:error while loading shared libraries: libaio解决方案

再安装

yum install -y libaio

提示成功后,初始化数据库:

mysqld --initialize --user mysql

Mysql开发实践:error while loading shared libraries: libaio解决方案

 

 

点击关注,第一时间了解华为云新鲜技术~