Start, stop, or restart your MySQL server; In this tutorial, you will learn three different methods to start, stop and restart mysql server on ubuntu using terminal or command line.
How to Start, Restart and Stop MySQL Server in Ubuntu 22.04 Linux
To start, stop or restart your MySQL server on a Linux ubuntu, you can follow the following three different commands that can be used to start, stop and restart MySQL server on linux ubuntu using the command line:
- Using Service Command
- Using init/d Command
- Using systemctl Command
Using Service Command
If you are using service distribution of MySQL, so you need to run the following service command to start, stop and restart of your MySQL server on Linux ubuntu using command line:
To start MySQL server:
sudo service mysqld start
To stop MySQL server:
sudo service mysqld stop
To restart MySQL server:
sudo service mysqld restart
Using init/d Command
If you are using init/d distribution of MySQL, so you need to run the following init/d command to start, stop and restart of your MySQL server on Linux ubuntu using command line:
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
Using systemctl Command
If you are using systemctl distribution of MySQL, so you need to run the following systemctl command to start, stop and restart of your MySQL server on Linux ubuntu using command line:
To start MySQL server:
sudo systemctl start mysqld
To stop MySQL server:
sudo sudo systemctl stop mysqld
To restart MySQL server:
sudo systemctl restart mysqld
Conclusion
That’s all; In this tutorial, you have learned three different methods to start, stop and restart MySQL server on Linux ubuntu using command line.