Database management is one of the most common tasks in small, medium and large companies since these allow a much more detailed and direct control over the data that should be recorded, as well as the structure that should be given to same.
Although there are several options at the database level, one of the most popular and used by thousands of administrators is MySQL which allows us to have a SQL database server (Structured Query Language) with functions and outstanding features such as security, access speed, scalability, support of multiple users and execution of various processes simultaneously.
When setting up a MySQL server , independent of the operating system used, it is natural that with the passage of time and when adding more and more tables and bases, at some point MySQL can generate some type of error either loading the databases, accessing to the queries or generating execution errors, if this happens to you, in TechnoWikis we give you a practical tip that will help you to refresh MySQL and is to stop or restart the MySQL services and thus be able to work in a complete and integral way with the bases created.
MySQL service startup
Let's see 3 options depending on your version.
/etc/init.d/mysqld start service mysqld start service mysql start
Stop the MySQL service
We have 3 options depending on the version.
/etc/init.d/mysqld stop service mysqld stop service mysql stop
Restart the MySQL service
/etc/init.d/mysqld restart service mysqld restart service mysql restart
You will learn to perform this process simply on macOS, Linux and Windows.
If you do not have MySQL installed you can go to the following link and download the appropriate version:
MySQL
1. How to start, stop or restart MySQL services in Windows 10
From the moment we install and configure our MySQL server in Windows 10, the system is responsible for restarting and stopping MySQL services to complete the installation processes properly. Now, if we have our server set up some time ago, we have some ways to carry out the tasks to start, restart or stop the services.
2. How to start, stop or restart MySQL services from the MySQL platform in Windows 10
Step 1
The first is using the MySQL platform itself, for this we must first log in to MySQL with the respective credentials:
Step 2
Once we establish connectivity, we will go to the Server menu and there we select the option "Startup / Shutdown":
Step 3
We will be redirected to the next section where we can see the current status of the MySQL server:
Step 4
As we see in this case, the server is active (running), to stop it, just click on the Stop Server button and we will see a summary of the task executed and verify that the server is stopped:
Step 5
To start it, we click on the "Start Server" button and we must enter our root password to complete the startup process:
3. How to start, stop or restart MySQL services from system services in Windows 10
Another method offered by Windows 10 to perform these activities is directly in the operating system services, when we install MySQL on Windows 10, a special service for MySQL is automatically created
Step 1
To verify this, we will use the following key combination and execute the services.msc command:
+ R
services.msc
Step 2
Click on OK and in the pop-up window we locate the MySQL service:
Step 3
We right click on the service mentioned and the options displayed will be possible. There we select the necessary option for our MySQL server.
- Start it if it has been stopped
4. How to start, stop or restart MySQL services from CMD in Windows 10
Another option available is to perform this task from the command prompt as administrators, for this we must access the console and execute the following:
C: \ Program Files \ MySQL \ MySQL Server 5.7 \ bin \ mysqld
Note
We can also execute the following order:
C: \ Program Files \ MySQL \ MySQL Server 8.0 \ bin \ mysqladmin "-u root shutdown
Thus, Windows allows us to perform these actions in various ways, but each of them practical.
5. How to start, stop or restart MySQL services on Linux
In Linux environments the tasks of starting, restarting or stopping the server are a bit simpler since these are worked from the console directly, so, in Linux, in this example Ubuntu Server 19.04
Step 1
We can first know the status of the MySQL server by running the following:
sudo service mysql status
Step 2
Now, to stop the service we will run:
service mysql stop
Step 3
To start the service we execute:
service mysql start
Step 4
If the objective is to restart the service we must execute the following:
service mysql restart
Step 5
Additionally in Linux we can execute the following commands to perform these actions:
/etc/init.d/mysqld start /etc/init.d/mysqld stop /etc/init.d/mysqld restart service mysqld start service mysqld stop service mysqld restart
6. How to start, stop or restart MySQL services from the MySQL platform in macOS
As in Windows 10, macOS offers us some options to perform this process in a useful way, we will see each one.
When installing MySQL on macOS, the MySQL administration platform will be installed by default, so that when we start the connection we can go to the Server menu and select the Startup / Shutdown option. After this we repeat the steps previously seen in Windows 10 to stop or start the MySQL service.
7. How to start, stop or restart MySQL services from System Preferences in macOS
Step 1
MySQL has a particularity and it is that as such it is not hosted in applications, all its configuration will be available from "System Preferences":
Step 2
By clicking on MySQL we will be redirected to the configuration window and in the "Instances" tab we can see the current version of MySQL used and stop (if active) the service:
Step 3
Clicking on Stop MySQL Server will need to enter the administrator password to authorize the action:
Step 4
Click on OK and we will see that the server is stopped and there is the option to start it with the "Start MySQL Server" button:
8. How to start, stop or restart MySQL services from the terminal in macOS
The macOS terminal allows us to perform the task of starting or stopping the MySQL service in a simple way.
Step 1
If we want to start the service, just run the following line:
sudo launchctl load -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
Step 2
If you wish to stop the service, we will execute the following:
sudo launchctl unload -F /Library/LaunchDaemons/com.oracle.oss.mysql.mysqld.plist
9. How to start, stop or restart MySQL services using DBngin
Step 1
This is a free utility with which we can manage various active databases in the system, you can work in parallel with PostgreSQL, MySQL, Redis and more, your free download is available at the following link:
DBngin
Step 2
Its use is simple, once installed we create a new instance with the type of database desired, in this case MySQL, we assign a name and if this database exists we will see the following:
Step 3
There we click on Start to start the service and after that we can click on Stop to stop the MySQL service:
10. How to start, stop or restart MySQL services using WHM
WHM (Web Host Manager) is a control panel in Linux environments thanks to which we will be able to manage various system parameters both at hardware and software level, working together with CPanel facilitating the use and management of hundreds of parameters .
Step 1
The first step is to access through the server's IP address and enter our access credentials:
Step 2
Once we access, we enter the search engine "restart" and we will see a list in the menu on the left with all the services that we can restart, in this case we select "SQL (Server) MySQL":
Step 3
Now we click on Yes and the MySQL service restart process will be carried out:
The options are varied and complete to start, stop or restart our MySQL service on Windows, macOS or Linux in an integral way.