[root@iZ2ze8tgnidj0t5sod2itiZ mysql]# mysql --version -bash: mysql: command not found [root@iZ2ze8tgnidj0t5sod2itiZ mysql]# yum reinstall mysql-community-common-8.0.16-2.el7.x86_64.rpm Loaded plugins: fastestmirror Examining mysql-community-common-8.0.16-2.el7.x86_64.rpm: mysql-community-common-8.0.16-2.el7.x86_64 No package matched to remove: mysql-community-common-0:8.0.16-2.el7 Error: Problem in reinstall: no package matched to remove [root@iZ2ze8tgnidj0t5sod2itiZ mysql]# yum remove mysql-community-server Loaded plugins: fastestmirror No Match for argument: mysql-community-server No Packages marked for removal
从你的输出来看,你尝试使用mysql --version
命令检查MySQL的版本,但系统显示未找到mysql
命令。这表明 MySQL 可能没有正确安装或者没有添加到系统PATH路径中。
在你尝试重新安装 MySQL 8.0 之前,我建议你先尝试安装 mysql 客户端:
yum install mysql
然后尝试检查 MySQL 版本:
mysql --version
如果 MySQL 客户端安装成功,你应该可以看到 MySQL 的版本信息。如果还是无法找到 mysql 命令,则需要重新安装 MySQL 8.0。
在重新安装 MySQL 8.0 之前,请确保你已经删除了之前的 MySQL 安装。你可以使用以下命令来删除 MySQL:
yum remove mysql-community-server
然后,按照我之前提供的步骤重新安装 MySQL 8.0。
[root@iZ2ze8tgnidj0t5sod2itiZ mysql]# mysql --version mysql Ver 15.1 Distrib 5.5.68-MariaDB, for Linux (x86_64) using readline 5.1 [root@iZ2ze8tgnidj0t5sod2itiZ mysql]#
根据你的输出,你的系统中安装的是 MariaDB 5.5.68 而不是 MySQL 8.0。
如果你需要安装 MySQL 8.0,你需要先删除 MariaDB。你可以使用以下命令来卸载 MariaDB:
yum remove mariadb-server mariadb
然后,按照我之前提供的步骤重新安装 MySQL 8.0。
请注意,删除 MariaDB 可能会导致某些应用程序出现问题,因为它们可能依赖于 MariaDB。在删除 MariaDB 之前,请确保你已经备份了所有重要数据,并检查你的应用程序是否支持 MySQL。
[root@iZ2ze8tgnidj0t5sod2itiZ yum.repos.d]# sudo yum -y install mysql-server Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile No package mysql-server available. Error: Nothing to do [root@iZ2ze8tgnidj0t5sod2itiZ yum.repos.d]#
看起来 mysql-server
包仍然无法找到。您可以尝试更新一下您的系统并重新安装 mysql-server
包:
sudo yum -y update
sudo yum -y install mysql-server
如果您的系统已经是最新的,那么可能需要更新您的 YUM 软件源配置。您可以尝试使用以下命令来更新 YUM 软件源配置:
sudo yum install -y epel-release
sudo yum install -y yum-utils
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community
sudo yum -y update
sudo yum -y install mysql-server
这个命令将会安装 epel-release
软件源,并对 MySQL 软件源进行了重新配置,然后更新系统并安装 mysql-server
包。如果还有其他问题,请让我知道。
相关推荐
















