yum module -y disable mysql
时间: 2024-01-14 14:04:37 浏览: 40
该命令用于禁用 CentOS 8 系统中的 mysql module。CentOS 8 中的软件包管理器 dnf 支持模块化的软件包管理,mysql module 是其中一个模块,用于安装和管理 MySQL 数据库。如果你不需要使用 MySQL 数据库,可以禁用该模块以避免不必要的资源浪费。
具体命令如下:
```
sudo yum module -y disable mysql
```
其中,-y 表示自动回答 yes,禁用 mysql module 后,就不能再使用 dnf 安装 MySQL 数据库了。如果你需要重新启用 mysql module,可以使用以下命令:
```
sudo yum module -y enable mysql
```
该命令会重新启用 mysql module,并允许使用 dnf 安装 MySQL 数据库。
相关问题
#!/usr/bin/env bash echo "此脚本用于yum 安装mysql" if [[ $UID -ne 0 ]];then echo "使用root 执行此脚本" exit 1 fi if [[ $# != 1 ]];then echo "Usage script (5.5|5.6|5.7|8.0)" exit 123 fi echo "清理环境" systemctl stop mysqld mariadb &>/dev/null yum erase -y `rpm -qa |grep mariadb` 2>/dev/null yum erase -y `rpm -qa |grep mysql` 2>/dev/null rm -rvf /etc/my.cnf /var/lib/mysql /var/log/mysql* userdel -rf mysql &>/dev/null ping -w3 www.baidu.com &>/dev/null if [[ $? -eq 0 ]];then yum install -y wget yum-utils &>/dev/null if [[ $? -ne 0 ]];then echo "yum 配置错误" exit 110 fi yum install -y https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm yum clean all yum makecache fast else echo "网络错误" exit 22 fi case $1 in 5.5) yum-config-manager --disable mysql80-community yum-config-manager --enable mysql55-community ;; 5.6) yum-config-manager --disable mysql80-community yum-config-manager --enable mysql56-community ;; 5.7) yum-config-manager --disable mysql80-community yum-config-manager --enable mysql57-community ;; 8.0) : ;; *) yum repolist all |grep mysql echo "其他版本可自行选择下载并配置" exit 13 ;; esac sleep 2 yum -y install mysql-community-server systemctl start mysqld echo "启动成功,初始密码如下(mysql5.7前版本没有初始密码)" grep -o 'root@localhost.*' /var/log/mysqld.log echo "安装完成" 优化以上这段脚本
这段脚本是用于在 Linux 系统上使用 yum 安装 MySQL 数据库的。脚本首先清理环境,停止已经运行的 MySQL 或 MariaDB 服务,并删除相关的文件和用户。然后通过检测网络连接状态,安装必要的工具和 MySQL 的 yum 源。根据用户指定的版本号,选择对应的 yum 源,并使用 yum 安装 MySQL。最后启动 MySQL 服务,并输出初始密码。这个脚本执行前需要以 root 用户身份执行,并且需要传递 MySQL 版本号作为参数。
yum -y install mysql-community-server与yum -y install mysql-server
这两个命令都可以用来安装MySQL数据库服务器,但是它们安装的软件包略有不同。
- `yum -y install mysql-community-server` 安装的是MySQL社区版的服务端软件包。
- `yum -y install mysql-server` 安装的是Red Hat Enterprise Linux(RHEL)和CentOS等Linux发行版的默认MySQL服务端软件包。
如果你想要使用MySQL社区版的最新特性和功能,可以选择安装`mysql-community-server`。如果你只需要基本功能的MySQL服务,可以选择安装`mysql-server`。
相关推荐
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![-](https://csdnimg.cn/download_wenku/file_type_column_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)