Home » Unix command and scripts » How to start and stop mysql on Linux

How to start and stop mysql on Linux

MySQL is a open source database widely used in Industry. If the MySQL. is hosted on Linux platform,here are the steps to stop and start the MySQL.

/etc/init.d/mysqld  status

The above gives the status of the mysql service

/etc/init.d/mysqld  stop

The above gives the stop of the mysql service

/etc/init.d/mysqld  start

The above gives the start of the mysql service

/etc/init.d/mysqld  restart

The above gives the stop and start of the mysql service

If you are getting the below error,

0 [Note] mysqld (mysqld 5.6.36) starting as process 1265 …
1265 [ERROR] Fatal error: Please read “Security” section of the manual to find out how to run mysqld as root!
1265 [ERROR] Aborting
1265 [Note] Binlog end
1265 [Note] mysqld: Shutdown complete

Then you may use the below commands for mysql

service mysqld status

The above gives the status of the mysql service

service mysqld stop

The above gives the stop of the mysql service

service mysqld start

The above gives the start of the mysql service

service mysqld restart

In some platform, you may use this command with

service mysql status
service mysql stop
service mysql start
service mysql restart

On some Linux version(Ubuntu) , following will work

systemctl mysql status
systemctl mysql stop
systemctl mysql start
systemctl mysql restart

See also  tr command in Unix

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top