View Single Post
  #7   (View Single Post)  
Old 3rd April 2009
TerryP's Avatar
TerryP TerryP is offline
Arp Constable
 
Join Date: May 2008
Location: USofA
Posts: 1,547
Default

How I start MySQL, in 3 easy listings. (note the user/group used is named _mysql)

in /etc/rc.local:

Code:
# launch the MySQL database server
if [ -x /usr/local/bin/mysqld_safe -a -x /etc/rc.mysql ]; then
        /etc/rc.mysql
fi

echo '.'
in /etc/rc.mysql:
Code:
#!/bin/sh
#
# A simple script to launch mysqld with the proper login privileges
#

su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &'
echo -n ' mysql'
in /etc/login.conf:

Code:
 #
 # This class is used when running MySQL from /etc/rc.local
 # XXX: It will *N_O_T* be used when starting/stopping mysqld manually!!
 #
 _mysql:\
         :ignorenologin:\
         :datasize=infinity:\
         :maxproc=infinity:\
         :openfiles=3580:\       # I've set this to sysctl::kern.maxfiles
         :stacksize-cur=8M:\
         :localcipher=blowfish,8:\
         :tc=daemon:
note: set it to need, see login.conf in OpenBSD manual for details.


The rc.mysql script is used so that if I have to stop my database for some reason, I can restart it with the correct credentials without having to check rc.local for the commands.



As Carpetsmoker, jggimi, and ocicat have pointed out - do be sure to read the documentation while you're at it, it helps.
__________________
My Journal

Thou shalt check the array bounds of all strings (indeed, all arrays), for surely where thou typest ``foo'' someone someday shall type ``supercalifragilisticexpialidocious''.

Last edited by TerryP; 3rd April 2009 at 04:18 PM.
Reply With Quote