停止 mysqld 的不同方法 |
您所在的位置:网站首页 › linux停掉服务命令 › 停止 mysqld 的不同方法 |
在 Windows 操作系统中启动/停止 mysqld(又名 MySQL 服务器)
在 Linux(Ubuntu 20.04)操作系统中启动/停止 mysqld(又名 MySQL 服务器)
结论
mysqld 是一个守护服务器程序,也称为 MySQL 服务器。它用于管理具有表和数据库的 MySQL 数据目录。 本教程将指导你了解可用于启动、停止或重新启动 MySQL 服务器 的各种方法。 每个人都必须根据他们使用的操作系统来启动和停止 mysqld。我们将探索使用 Windows 和 Linux (Ubuntu 20.04) 操作系统启动、停止和重新启动 MySQL 服务器的不同方法。 在 Windows 操作系统中启动/停止 mysqld(又名 MySQL 服务器) 方法 1 - 使用 Windows 运行对话框如果你使用的是 Windows 操作系统,则可以使用 Windows 运行对话框。你可以通过按 Windows+R 打开它。打开后,输入 services.msc(见下文),然后按确定。 搜索 MySQL##(这里 ## 代表版本)。如果你有 MySQL 8.0,请在以下屏幕上查找 MySQL80。 现在,MySQL Server 正在运行。右键单击 MySQL##(将 ## 替换为你的 MySQL 版本)并选择停止。你也可以从此处选择暂停或重新启动。 它将停止 mysqld(MySQL 服务器)。请参阅以下屏幕截图。 你还可以从 services 的菜单栏中启动、停止、暂停或重新启动 MySQL 服务器,如下所示。 方法 2 - 使用 Windows 命令提示符如果你对 Windows 命令提示符(也称为 CMD)感到满意,也可以从命令行停止 MySQL 服务器。以管理员身份打开命令提示符(请参见下面给出的屏幕截图)。 它将打开一个黑色窗口并转到 MySQL bin 文件夹 C:\Program Files\MySQL\MySQL Server 8.0\bin。 如果你想确认你的 MySQL 服务器是否正在运行,你可以使用以下命令进行检查。用你的用户名替换用户名。 键入给定命令并按 Enter 后,它将要求输入密码。输入你的密码,如果没有,请按回车键。 mysqladmin -u [username] -p status我们的 MySQL 服务器当前处于活动状态;见下面的截图。 我们可以停止它并在命令行中确认服务器的不活动,如下所示。你也可以在 services.msc 中看到它。 -- replace [username] with yours mysqladmin -u [username] -p shutdown --check status mysqladmin -u [username] -p status你可以看到以下命令的实际使用,并注意到我们在关闭它后无法连接。 在 Linux(Ubuntu 20.04)操作系统中启动/停止 mysqld(又名 MySQL 服务器)在 Linux 操作系统中,你可以使用不同的命令来启动/停止 MySQL 服务器。这种变化取决于你使用的 Linux 发行版。 我们在本文中使用 Linux (Ubuntu 20.04)。 如果你也是 Linux (Ubuntu 20.04) 用户,你可以使用以下命令停止 MySQL 服务器,然后检查状态以确认。Fedora 用户可以查看 this 文档,CentOS 命令与 Fedora 非常相似。 -- if you are logged in as superuser (root user) then use the following commands systemctl stop mysql systemctl status mysql -- if you are not logged in as superuser (root user) then use the following commands sudo systemctl stop mysql sudo systemctl status mysql使用以下命令在 Ubuntu 中启动 MySQL 服务器。 -- if you are logged in as superuser (root user) then use the following commands systemctl start mysql systemctl status mysql -- if you are not logged in as superuser (root user) then use the following commands sudo systemctl start mysql sudo systemctl status mysql -- You can use the following command to make sure that the server launches after reboot systemctl enable mysql # OR sudo systemctl enable mysql绿点和绿色文本表示你的服务器已启动并正在运行(请参见下面的屏幕截图)。 使用下面给出的命令重新启动 MySQL 服务器。 -- if you are logged in as superuser (root user) then use the following commands systemctl restart mysql systemctl status mysql -- if you are not logged in as superuser (root user) then use the following commands sudo systemctl restart mysql sudo systemctl status mysql在 Ubuntu 20.04 中执行此操作的另一种方法如下。 -- if you are logged in as superuser (root user) then use the following commands service start mysql service stop mysql -- if you are not logged in as superuser (root user) then use the following commands sudo service start mysql sudo service stop mysql 结论在本文中,我们了解到 mysqld 也称为 MySQL 服务器。 根据操作系统,我们有不同的方法来启动/停止它。此外,根据你使用的 Linux 发行版,Linux 命令会有所不同。 |
今日新闻 |
点击排行 |
|
推荐新闻 |
图片新闻 |
|
专题文章 |
CopyRight 2018-2019 实验室设备网 版权所有 win10的实时保护怎么永久关闭 |