centos7卸载mysql_安装MySQL

卸载MySQL:yum remove mysql-server mysql-client mysql-devel;安装MySQL:yum install mysql-server

卸载MySQL

centos7卸载mysql_安装MySQL

在 CentOS 7 上卸载 MySQL,可以使用以下步骤:

1、停止 MySQL 服务

需要停止正在运行的 MySQL 服务,可以使用以下命令停止 MySQL:

```

sudo systemctl stop mysqld

centos7卸载mysql_安装MySQL

```

2、移除 MySQL 软件包

使用 yum 命令来卸载 MySQL,以下是具体的命令:

```

sudo yum remove mysql mysqlserver

centos7卸载mysql_安装MySQL

```

3、删除 MySQL 配置文件和数据目录

默认情况下,MySQL 的数据目录位于 /var/lib/mysql,配置文件位于 /etc/my.cnf,你可以使用以下命令删除这些文件和目录:

```bash

sudo rm rf /var/lib/mysql/*

sudo rm /etc/my.cnf

```

4、删除 MySQL 用户和组

如果你在安装过程中创建了 MySQL 用户和组,现在可以删除它们:

```bash

sudo userdel r mysql

sudo groupdel mysql

```

5、清理 YUM 缓存

使用以下命令清理 YUM 的缓存:

```bash

sudo yum clean all

```

以上步骤完成后,MySQL 应该已经完全从你的 CentOS 7 系统中卸载,你可以通过运行 mysql version 命令来确认这一点,如果返回 "command not found",那么说明已经成功卸载。

安装MySQL

在 CentOS 7 上安装 MySQL,可以使用以下步骤:

1、添加 MySQL Yum Repository

你需要添加 MySQL Yum repository,以下是具体的命令:

```bash

wget https://dev.mysql.com/get/mysql80communityreleaseel73.noarch.rpm

sudo yum localinstall mysql80communityreleaseel73.noarch.rpm

```

2、安装 MySQL Community Server

接下来,你可以安装 MySQL Community Server,以下是具体的命令:

```bash

sudo yum install mysqlcommunityserver

```

3、启动并设置开机启动

安装完成后,你可以使用以下命令启动 MySQL:

```bash

sudo systemctl start mysqld

```

你可以使用以下命令设置开机启动:

```bash

sudo systemctl enable mysqld

```

你也可以检查 MySQL 是否正在运行:

```bash

sudo systemctl status mysqld

```

如果显示 "active (running)",那么说明 MySQL 正在运行。

4、获取临时密码

在第一次启动 MySQL 时,它会生成一个临时密码,你可以使用以下命令获取这个临时密码:

```bash

sudo grep 'temporary password' /var/log/mysqld.log | tail 1 | cut b65123 # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of MySQL, use: "cut b65123" instead of "cut b64123". If you are running a version of MariaDB that is newer than version 10.1, use: "cut b64123" instead of "cut b65123". The output should look like this: "A temporary password is generated for root@localhost: XXXX". The XXXX is your temporary password. # For newer versions of MariaDB and older versions of

原创文章,作者:K-seo,如若转载,请注明出处:https://www.kdun.cn/ask/522789.html

Like (0)
Donate 微信扫一扫 微信扫一扫
K-seo的头像K-seoSEO优化员
Previous 2024-06-06 02:40
Next 2024-06-06 02:45

相关推荐

  • 初始化mysql_安装社区版MySQL

    下载社区版MySQL安装包,运行安装程序,按照提示进行配置,完成安装后设置root密码即可。

    2024-06-05
    094
  • cmd安装mysql数据库_安装MySQL

    使用cmd命令行工具,输入安装命令并按照提示操作,即可完成MySQL数据库的安装。

    2024-06-05
    0110
  • 如何在本地环境成功安装社区版MySQL?

    MySQL社区版是免费的开源数据库,安装过程简单。首先访问MySQL官网下载安装包,然后按照提示进行安装,设置root用户密码和创建新用户。完成后启动MySQL服务,使用命令行或图形界面工具连接并管理数据库。

    2024-08-12
    040
  • 如何正确安装MySQL客户端并连接到服务器?

    要安装MySQL客户端,首先需要确定你的操作系统。对于Windows,你可以从MySQL官方网站下载Windows版的MySQL Installer,并选择"Client only"选项进行安装。对于Linux,可以使用包管理器如apt(Debian/Ubuntu)或yum(CentOS/RHEL)来安装。在Ubuntu上,可以使用以下命令:,,``,sudo aptget update,sudo aptget install mysqlclient,``

    2024-08-12
    046
  • 如何在Mac上安装和配置MySQL数据库文件?

    要在Mac上安装和配置MySQL数据库,你可以按照以下步骤操作:前往MySQL官网下载适用于Mac的安装包。双击下载的文件并按照提示进行安装。打开系统偏好设置中的MySQL,点击“Start MySQL Server”启动服务。通过命令行工具登录MySQL并进行相关配置。

    2024-08-10
    091
  • 如何配置Mac上的MySQL服务器?

    在Mac上配置MySQL服务器,你需要先安装MySQL Server。可以通过Homebrew或者直接从Oracle官网下载DMG文件进行安装。安装完成后,启动MySQL服务,使用命令sudo mysql.server start。然后通过命令mysql u root p登录MySQL,输入密码后即可进入MySQL命令行界面进行数据库操作。

    2024-08-15
    068

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

免备案 高防CDN 无视CC/DDOS攻击 限时秒杀,10元即可体验  (专业解决各类攻击)>>点击进入