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.

link|improve this question
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 at 4:01
feedback

migrated from stackoverflow.com Jan 10 at 4:29

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

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
link|improve this answer
2  
init.d/rc.d depends on the distro. – Andrew Jan 10 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 at 5:06
feedback

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.

link|improve this answer
feedback

Usually Linux distros have an rc script; for example:

/etc/rc.d/apache2 restart | stop
/etc/rc.d/mysqld start | stop
link|improve this answer
feedback

Your Answer

 
or
required, but never shown