Saturday, 15 September 2018

How to Start/Stop MySQL Server in CentOS 6



The service and chkconfig script are used to verify all the services whether it is running or stopped and enable or disabled at startup.
Run the following commands to check service status startup status:

[root@linuxcnf ~]# service mysqld status
mysqld (pid  27892) is running...
[root@linuxcnf ~]#
 [root@linuxcnf ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off
[root@linuxcnf ~]#
  
Run the following commands to start the MySQL service and configure it to automatically start when Linux server is booted by default:

[root@linuxcnf ~]# service mysqld start
Starting mysqld:                                           [  OK  ]
[root@linuxcnf ~]#
[root@linuxcnf ~]# chkconfig mysqld on
[root@linuxcnf ~]#

Run the following commands to stop the MySQL service and configure it to stop when Linux server is rebooted and do not start by default:

[root@linuxcnf ~]# service mysqld stop
Stopping mysqld:                                           [  OK  ]
[root@linuxcnf ~]#
[root@linuxcnf ~]# chkconfig mysqld off
[root@linuxcnf ~]#
[root@linuxcnf ~]# chkconfig --list mysqld
mysqld          0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@linuxcnf ~]#

Now the MySQL Service is stopped and will not start when the server will reboot.

No comments:

Post a Comment