Details three ways to start and under Ubuntu Server to stop and and restart MySQL database

  • 2021-06-29 12:14:43
  • OfStack

Three ways to start/stop/restart MySQL database under Ubuntu Server

System environment: ubuntu server 12.10 x64 (mysql is system-owned)

When we need to repair ​​When changing MySQL's configuration file my.cnf (my.ini under windows) to make some settings, we need to restart MySQL after the modification.

The location of the my.cnf file is: /ect/mysql/my.cnf

Waring: If the file is misconfigured, MySQL will not be able to start.

Here are three ways to start/stop/restart MySQL:

Start mysql:

Mode 1:


sudo /etc/init.d/mysql start 

Mode 2:


sudo start mysql

Mode 3:


sudo service mysql start

Stop mysql:

Mode 1:


sudo /etc/init.d/mysql stop 

Mode 2:


sudo stop mysql

Mode 3:


sudo service mysql stop

Restart mysql:

Mode 1:


sudo/etc/init.d/mysql restart

Mode 2:


sudo restart mysql

Mode 3:


sudo service mysql restart

Related articles: