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.

  • 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

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
  • 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. Jan 10 '12 at 5:06

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.


Usually Linux distros have an rc script; for example:

/etc/rc.d/apache2 restart | stop
/etc/rc.d/mysqld start | stop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy