Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

On Windows a command like net start mysql will try to start the MySQL service. I am looking for equivalent Linux command to do that - to change the status of services through Linux commands.

share|improve this question

migrated from stackoverflow.com Jan 10 '12 at 4:29

This question came from our site for professional and enthusiast programmers.

1  
It depends somewhat on what distro you're using. Many use the scripts in /etc/rc.d, but Ubuntu encourages you to use service. –  Kevin Jan 10 '12 at 4:01
add comment

3 Answers

up vote 3 down vote accepted

A lot of linux'es support the service command

service mysql.server start

This is related to chkconfig

[root@iceweasel init.d]# chkconfig --list mysql.server

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

mysql.server    0:off   1:off   2:on    3:on    4:on    5:on    6:off

Otherwise you can do it the old fashioned way

cd /etc/init.d
./mysql.server start
share|improve this answer
2  
init.d/rc.d depends on the distro. –  Andrew Jan 10 '12 at 5:01
    
@Andrew totally - can you remember/know some distro's that still use the /etc/rc.d style and I'll list them and I will add them to my answer with accreditation. –  Adrian Cornish Jan 10 '12 at 5:06
add comment

Your "service" scripts are all stored in /etc/init.d, so the normal way is to use sudo /etc/init.d/mysqld start (or whatever service you want to start). Modern Linux distributions have the service command which does a similar thing, so also try service mysqld start.

share|improve this answer
add comment

Usually Linux distros have an rc script; for example:

/etc/rc.d/apache2 restart | stop
/etc/rc.d/mysqld start | stop
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.