How do you stop a mysql database?

When using MySQL, there are times when it’s important to know how to start, stop, or restart your MySQL server. Luckily, there are multiple, easy ways to do this. Which methods are available to you however, will depend on the operating system your running. 

Read on to learn how to start, stop, and restart MySQL server in both Linux and Windows.

How to Start, Stop, and Restart MySQL Server in Linux

If you need to stop or restart your MySQL server on a Linux system, there are three different commands that can be used:

  1. Depending on your Linux distribution, you can change the state of MySQL using the service command.
    • To start MySQL server:
       
      sudo service mysqld start
       
    • To stop MySQL server:
       
      sudo service mysqld stop
       
    • To restart MySQL server:
       
      sudo service mysqld restart
       
  2. If you don’t have the service command available or would prefer to make changes to MySQL using a different method, you can also use the init.d command to start/stop your MySQL server.
    • To start MySQL server:
       
      sudo /etc/init.d/mysqld start
       
    • To stop MySQL server:
       
      sudo /etc/init.d/mysqld stop
       
    • To restart MySQL server:
       
      sudo /etc/init.d/mysqld restart
       
  3. Lastly, you can also use the systemctl command to start, stop, and restart applications on Linux, including MySQL.
    • To start MySQL server:
       
      sudo systemctl start mysqld
       
    • To stop MySQL server:
       
      sudo systemctl stop mysqld
       
    • To restart MySQL server:
       
      sudo systemctl restart mysqld
       

How to Start, Stop, and Restart MySQL Server in Windows

If you’re trying to start, stop, or restart your MySQL server on a Windows-based system, you can do so easily from the command line. Just follow these 3 steps:

  1. To start, you’ll first need to open a terminal window. If you don’t have this somewhere easily accessible, you can find it quickly using the Windows’ Run dialog. To open the Run dialog, just press the Windows Key + R.
     
  2. Next, type in “cmd and press the Enter key. This will open a new terminal window.
     
  3. Once you’ve opened a terminal window, just type the following commands to start or stop MySQL server:
    • To start MySQL server:
        
      mysqld start
       
    • To stop MySQL server:
       
      mysqld stop
       

*Note: depending on which version of Windows you are running, you may need the specific name of the MySQL version number you are running in order to start or stop the service. To find this, go to the start menu and search for Services. Locate the version of MySQL you are using and try the following commands, replacing “##” with your version number:

net start MySQL##

net stop MySQL##

For instance, if you’re running MySQL 8.0, replace “MySQL##” with “MySQL80”.

And there you have it! You now have several different methods for starting, stopping, and restarting MySQL server as needed. 

Popular Links

Looking for more information on MySQL? Search our Knowledge Base!

Interested in more articles about Databases? Navigate to our Categories page using the bar on the left or check out these popular articles:

  • View the Contents of a Table in a SQL Server Database Using Enterprise Manager
  • Create a MySQL Backup from Command Line – MySQL Import SQL File
  • How to Install SQL Server 2012 Express on Windows Server 2012

Popular tags within this category include: MySQL, MSSQL, phpMyAdmin, PostgreSQL, and more. 

Don’t see what you’re looking for? Use the search bar at the top to search our entire Knowledge Base.

The Hivelocity Difference

Seeking a better Dedicated Server solution? In the market for Private Cloud or Colocation services? Check out Hivelocity’s extensive list of products for great deals and offers.

With best-in-class customer service, affordable pricing, a wide-range of fully-customizable options, and a network like no other, Hivelocity is the hosting solution you’ve been waiting for.

Unsure which of our services is best for your particular needs? Call or live chat with one of our sales agents today and see the difference Hivelocity can make for you.

How stop MySQL in terminal?

Stop the MySQL Server.
IMPORTANT: Do not stop the MySQL server if the rest of the STA application is running..
Open a terminal session on the STA server, and log in as the Oracle user..
Stop the MySQL server: $ STA stop mysql..
Verify the server is not running: $ STA status mysql. You should see: mysql is shutdown..

Can't stop MySQL server?

This issue usually results from an incorrect service name reference. This arises when the MySQL Workbench contains a reference to an older service name (e.g. mysql), whereas MySQL Server 8.0. x uses the service name MySQL80.

How do you stop a database in MySQL Workbench?

To manually start, stop, or restart the Workbench service, In the Windows system taskbar, right-click the Workbench service icon. A menu appears. Select Service, then click the option you want (Start, Stop, or Restart).