WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

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

Offline manit123

  • Sr. Member
  • ****
  • Posts: 315
[solved] how to start mysql service via command in startup
« on: October 20, 2014, 09:25:34 PM »
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, 03:37:20 AM by manit123 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: how to start mysql service via command in startup
« Reply #1 on: October 20, 2014, 09:35:13 PM »
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 20, 2014, 10:18:17 PM »
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 1652
Re: how to start mysql service via command in startup
« Reply #3 on: October 21, 2014, 11:36:48 PM »
Code: [Select]
echo "/etc/init.d/services/mysql start" >> bootlocal.sh
Over 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Offline manit123

  • Sr. Member
  • ****
  • Posts: 315
Re: how to start mysql service via command in startup
« Reply #4 on: October 22, 2014, 03: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.