Unix Technical Forum

how to start mysql server at boot time

This is a discussion on how to start mysql server at boot time within the Linux Operating System forums, part of the Unix Operating Systems category; --> dear everyone we've been starting mysql server manually by typing bin/safe_mysqld from the shell...but i wanted to know how ...


Go Back   Unix Technical Forum > Unix Operating Systems > Linux Operating System

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-19-2008, 07:10 AM
grace
 
Posts: n/a
Default how to start mysql server at boot time

dear everyone
we've been starting mysql server manually by typing bin/safe_mysqld
from the shell...but i wanted to know how we could set it start
automatically upon restarting the machine.. i've been browsing the
internet and found some solutions like this one:

To start MySQL server automatically when you
boot your machine,
copy the mysql.server script to the `/etc/init.d'
directory with the name
mysql, and then make it executable


cp support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql


10) Activate to run the script at system startup by
adding to the chkconfig list


chkconfig --add mysql
chkconfig --level 345 mysql on

i did found the mysql.server file but i am unable to do a chkconfig as
it is returning a 'bash: chkconfig: command not found' msg..i tried
'#whereis chkconfig' but returns no path, and '#man chkconfig' but
says 'no manual entry for chkconfig'...does this mean i haven't
intalled the chkconfig feature? how would i install it if am going to
use this option?

another option w/c i've been thnkng is to create a script (a .sh file)
w/c would run this statement:
cd /usr/local/mysql-standard-4.1.22-pc-linux-gnu-i686-glibc23
bin/safe_mysqld

...but i don't know how to make this run upon start up...

or are there any other way to restart the mysql server at boot time?
i am new to linux...we really need somone's help
grace

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-19-2008, 07:10 AM
Davide Bianchi
 
Posts: n/a
Default Re: how to start mysql server at boot time

On 2007-06-12, grace <zympoul@gmail.com> wrote:
> from the shell...but i wanted to know how we could set it start
> automatically upon restarting the machine.


It depends by your distribution, if it uses System V startup scripts
(/etc/init.d) add a script in there and connect it using the various
runlevel directories.

> i did found the mysql.server file but i am unable to do a chkconfig as
> it is returning a 'bash: chkconfig: command not found' msg..i tried


chkconfig is used in most RedHat and derivate distributions, maybe
your distro doesn't use it.

> ..but i don't know how to make this run upon start up...


Moste distro have a 'local' script that is called after everything else,
just put it in that script.

Davide

--
I'm not in favor of senseless Micro$oft bashing. I'm in favor of bashing
Micro$oft senseless.
-- From a Slashdot.org post
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-19-2008, 07:10 AM
grace
 
Posts: n/a
Default Re: how to start mysql server at boot time


Ayon kay Davide Bianchi:
> On 2007-06-12, grace <zympoul@gmail.com> wrote:
> > from the shell...but i wanted to know how we could set it start
> > automatically upon restarting the machine.

>
> It depends by your distribution, if it uses System V startup scripts
> (/etc/init.d) add a script in there and connect it using the various
> runlevel directories.
>
> > i did found the mysql.server file but i am unable to do a chkconfig as
> > it is returning a 'bash: chkconfig: command not found' msg..i tried

>
> chkconfig is used in most RedHat and derivate distributions, maybe
> your distro doesn't use it.
>
> > ..but i don't know how to make this run upon start up...

>
> Moste distro have a 'local' script that is called after everything else,
> just put it in that script.
>
> Davide
>
> --
> I'm not in favor of senseless Micro$oft bashing. I'm in favor of bashing
> Micro$oft senseless.
> -- From a Slashdot.org post


we are using ubuntu 5.10 (the breezy badger')...i could see the /etc/
init.d folder..where i added a script which i named mysql.sh
i then execute this command -> '# chmod +x /etc/init.d/mysql.sh
to make it executable...
then what's next? i am sorry i really don't know how to do it.. tnx...

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 01-19-2008, 07:10 AM
John Taylor
 
Posts: n/a
Default Re: how to start mysql server at boot time

grace wrote:

>
> we are using ubuntu 5.10 (the breezy badger')...i could see the /etc/
> init.d folder..where i added a script which i named mysql.sh
> i then execute this command -> '# chmod +x /etc/init.d/mysql.sh
> to make it executable...
> then what's next? i am sorry i really don't know how to do it.. tnx...


Hmmm...

How did you install mysql ?
Normally 'apt-get install' should do all this stuff for you.

I don't think that mysql.server is the correct script to put in init.d
The scriptss that go here normally take a parameter like start or stop
or restart or reload to tell them what to do.

I *Think* (without seeing it - I don't have a mysql.server on my unubtu
6.06), that this just starts mysql.

If you just run it, and it starts mysql, then you need to run it from
/etc/rc.local

your rc.local probably looks something like this:

-----------------

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

-------------


What you need to do is to add the path to your mysql script on a new
line at the end of that file, using your favourite text editor.

e.g.:
-----------------

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

#run mysql at startup
/var/lib/mysql/mysql.server

-------------



You may also need to change the permissions on /etc/rc./local to make it
executable by root:

# chmod u+rwx /etc/rc.local



Regards
JohnT


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 01-19-2008, 07:11 AM
saf
 
Posts: n/a
Default Re: how to start mysql server at boot time

grace wrote:
> dear everyone
> we've been starting mysql server manually by typing bin/safe_mysqld
> from the shell...but i wanted to know how we could set it start
> automatically upon restarting the machine.. i've been browsing the
> internet and found some solutions like this one:


This is normally full automatic on modern Linux distributions. If you
use Debian, Ubuntu or Gentoo Linux, they ship already scripts which
helps to start MySQL full automatic at boot up.
Maybe your Linux distribution has also a package which contains already
MySQL?

--
saf
E-Mail protected against spam: ihnnsfbg@smtp2.trashmail.net
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:03 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com