Restart the MySQL database under Windows

This article introduces three methods, which are simple and effective, and do not require too much troublesome code.

The first method: Restart the application through the service service. simple and effective

Preparations: Open the service service application first.

For how to start the service application, you can recommend reading this article. Or search keywords: Windows open service

http://t.csdn.cn/SeSjc

Here is a convenient one: win+R key combination, the running window will pop up, enter services.msc

Then open the service, and then find MySQL, right-click to select it, and click Start or Close.

The second method: cmd enters the bin directory of the MySQL installation directory, and enters the specified code.

This method is more advanced, first you need to know the installation path of your MySQL, and then enter the bin directory through cmd.

As for your MySQL path, if you haven’t changed it, it’s usually in C:\Program Files\MariaDB 10.3\bin to check on your computer, copy it, and then enter cmd cd + path.

Win+R key combination, pop-up run window, enter cmd 

Then enter cd C:\Program Files\MariaDB 10.3\bin to enter the path

 Here comes the key point:

Enter mysqladmin -uroot -proot shutdown

Here -u is followed by your MySQL root account, and -p is followed by the password of this account. Remember that there is no space between these two, and it is directly followed by the account password. But, but, it cannot be closed (●'◡'●). You first = you will know after seeing it.

After entering, see the figure below, and your MySQL startup is complete. However, this window cannot be closed. 

You can open another cmd window and enter mysql -uroot -proot to start MySQL through cmd. It is still the same as above. This is the account password. It does not need to be an administrator. Ordinary users can also open it. It means that you are in the previous step. Start the database successfully, as shown below

 To sum up:

There is a flaw in this method of starting, that is, once the window is closed, MySQL stops again.

My understanding of it is that the previous startup was started through  Service (service), which is an application component that can perform long-running operations in the background without a user interface. Just like your software has been running directly in the background, but this way is to run and start through cmd, this window is a program, you close it, it is gone, that's it.

There is also an advantage, you don't have to worry about shutting down the server anymore, it will also be shut down when people leave the office. This method is not recommended, but it can be used for normal use.

The third method: administrator cmd starts MySQL

You can refer to the documentation on this site: How to start mysql on Windows through the cmd command line

Since you want to pursue high quality, then high quality.

It is still win+R combination key, the running window pops up, enter cmd  but this  Ctrl Shift +Enter time it is started by the administrator

See, it's different, cmd is cmd, administrator is administrator

 Then there is the magic code:

.Start mysql: enter net start mysql;

.Stop mysql: enter net stop mysql;

As shown in the picture below, it is OK, if not, turn at the top, and the recommended link below the third one. 

Well, this is the end here. There are three ways to restart MySQL. It is simple and rude to suggest directly through the service, which is convenient and quick. Hyun directly manages cmd with one hand.

Simple record, please correct me if there is any mistake, thank you! Especially for the previous understanding of the second type, welcome to understand the underlying answer.

Also, if these startup methods may cause damage to the database, please be sure to remind me in time, thank you.

Guess you like

Origin blog.csdn.net/forzhongguo/article/details/127466476