WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [solved] how to start mysql service via command in startup  (Read 5472 times)

Offline manit123

  • Sr. Member
  • ****
  • Posts: 315
[solved] how to start mysql service via command in startup
« on: October 21, 2014, 12:25:34 AM »
hi ,
I want to add entry in startup file so that 'mysql' service does not have to be explicitly selected from system tools > control panel > services .
How can I do that ?
« Last Edit: October 22, 2014, 06:37:20 AM by manit123 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11702
Re: how to start mysql service via command in startup
« Reply #1 on: October 21, 2014, 12:35:13 AM »
Hi manit123
Go to  /etc/init.d/services  and take a look inside the  mysql  file to see what the start command looks like. Then add it to  bootlocal.sh.

Offline manit123

  • Sr. Member
  • ****
  • Posts: 315
Re: how to start mysql service via command in startup
« Reply #2 on: October 21, 2014, 01:18:17 AM »
got it
Quote
tc@box:~$ cd /etc/init.d/services/
tc@box:/etc/init.d/services$ ls
crond  dhcp   mysql  tftpd
tc@box:/etc/init.d/services$ cat mysql
#!/bin/sh

case "${1}" in
    start)
        su -c "cd /usr/local/mysql/bin;./mysqld_multi --log=/var/log/mysql/mysql.log start 1" - tc
        ;;

    stop)
        pkill mysqld
        ;;

    status)
        pidof mysqld
        ;;

    *)
        exit 1
        ;;
esac

Offline CentralWare

  • Retired Admins
  • Hero Member
  • *****
  • Posts: 776
Re: how to start mysql service via command in startup
« Reply #3 on: October 22, 2014, 02:36:48 AM »
Code: [Select]
echo "/etc/init.d/services/mysql start" >> bootlocal.sh

Offline manit123

  • Sr. Member
  • ****
  • Posts: 315
Re: how to start mysql service via command in startup
« Reply #4 on: October 22, 2014, 06:36:07 AM »
thanks centralware .
it is wise to run /etc/init.d/services/mysql with start option instead of adding  'su -c ...' .
Consider this thread solved.