Different ways to stop mysqld
mysqld
Is a daemon server program, also known as MySQL server. It is used to manage the MySQL data directory with tables and databases.
This tutorial guides you through the various methods you can use to start, stop, or restart a MySQL server.
Each one has to start and stop depending on the operating system they are using mysqld
. We will explore different ways to start, stop, and restart the MySQL server using both Windows and Linux (Ubuntu 20.04) operating systems.
mysqld
Start/Stop (aka MySQL Server) in Windows OS
Method 1 - Using the Windows Run Dialog Box
If you are using Windows operating system, you can use the Windows Run dialog box. You can open it by pressing Windows+ R. Once opened, enter services.msc
(see below) and press OK.
Search for MySQL##
(here ##
represents the version). If you have MySQL 8.0, look for MySQL80 on the following screen.
Now, MySQL Server is running. Right-click MySQL## (replace ## with your MySQL version) and select Stop. You can also select Pause or Restart from here.
It will stop mysqld
(MySQL server). See the following screenshot.
You can also services
start, stop, pause, or restart the MySQL server from the menu bar as shown below.
Method 2 - Using Windows Command Prompt
If you are comfortable with Windows Command Prompt (also known as CMD), you can also stop the MySQL server from the command line. Open the command prompt as an administrator (see the screenshot given below).
It will open a black window and go to the MySQL bin folder C:\Program Files\MySQL\MySQL Server 8.0\bin
.
If you want to confirm that your MySQL server is running, you can check it using the following command. Replace with your username 用户名
.
After typing the given command and pressing Enter, it will ask for the password. Type your password, if you don’t have one, press Enter.
mysqladmin -u [username] -p status
Our MySQL server is currently active; see the screenshot below.
We can stop it and confirm the inactivity of the server in the command line as shown below. You can also services.msc
see it in .
-- replace [username] with yours
mysqladmin -u [username] -p shutdown
--check status
mysqladmin -u [username] -p status
You can see the following command in action and notice that we are unable to connect after turning it off.
mysqld
Start/Stop MySQL Server (aka. MySQL Server) in Linux (Ubuntu 20.04) Operating System
In Linux operating system, you can use different commands to start/stop MySQL server. This varies depending on the Linux distribution you are using.
We are using Linux (Ubuntu 20.04) in this article.
If you are also a Linux (Ubuntu 20.04) user, you can stop the MySQL server using the following command and then check the status to confirm. Fedora users can check this document, the CentOS command is very similar to 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
Use the following command to start MySQL server in Ubuntu.
-- 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
A green dot and green text means your server is up and running (see screenshot below).
Restart the MySQL server using the command given below.
-- 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
Another way to do this in Ubuntu 20.04 is as follows.
-- 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
in conclusion
In this article, we have learned mysqld
that is also known as MySQL server.
Depending on the OS, we have different ways to start/stop it. Also, depending on the Linux distribution you are using, the Linux commands will be different.
For reprinting, please send an email to 1244347461@qq.com for approval. After obtaining the author's consent, kindly include the source as a link.
Related Articles
If ELSE in MySQL
Publish Date:2025/04/11 Views:85 Category:MySQL
-
In this tutorial, we aim to explore how to use IF ELSE the statement in MySQL. One of the key roles of a data analyst is to gather insights from the data and produce meaningful results. It can be done with the help of several data filtering
DATETIME vs. TIMESTAMP in MySQL
Publish Date:2025/04/11 Views:117 Category:MySQL
-
DATETIME and TIMESTAMP are two different data types that can be used to store values that must contain both a date and a time portion. In this article, we will understand how it is stored in the database and the memory required for ea
Execute multiple joins in one query in MYSQL
Publish Date:2025/04/11 Views:94 Category:MySQL
-
Have you ever wondered how to include multiple joins in one query in MySQL? You have come to the right place. Remember that joins allow us to access information from other tables. This information is included separately to avoid redundancy.
Joining 3 tables in MySQL
Publish Date:2025/04/11 Views:187 Category:MySQL
-
In this tutorial, we will learn how to join three tables in MySQL. Businesses and organizations may have to visualize three tables simultaneously based on certain matching columns common to all three tables. This operation is allowed in MyS
Use of UPDATE JOIN in MySQL
Publish Date:2025/04/11 Views:85 Category:MySQL
-
This tutorial will explain how to use the statement in MySQL database UPDATE JOIN . We generally use joins to iterate over the rows in a particular table which may or may not have similar rows in other tables. We can UPDATE use JOIN the cla
How to use the Row_Number() function in MySQL
Publish Date:2025/04/11 Views:142 Category:MySQL
-
In this tutorial, we will explain how to use the VALUES function in MySQL ROW_NUMBER() . This is a sorting method that assigns consecutive numbers within a partition starting from 1. It is important to note that no two rows within a partiti
Multiple primary keys in MySQL
Publish Date:2025/04/11 Views:66 Category:MySQL
-
In this tutorial, our goal is to explore the concept of multiple primary keys for a table in MySQL. Many times, businesses and organizations have to assign certain columns as primary keys. This primary key has multiple uses and reasons to b
Displaying foreign keys in MySQL
Publish Date:2025/04/11 Views:55 Category:MySQL
-
In this tutorial, we aim to explore how to display foreign keys for tables and columns in MySQL. The type of key that references a primary key, also known as the primary key of another table, is called a foreign key. Understanding the forei
Select first N rows in MySQL
Publish Date:2025/04/11 Views:85 Category:MySQL
-
Sometimes, you have to select first N rows of MySQL database according to your project requirements. n The value of varies according to the requirement; it can be TOP 1 row or TOP 30 rows. We will learn how to select top N rows using the cl