CP Web Hosting
CP Web Hosting
 

Go Back   Hosting Forums - cp web hosting > Server Scripting > SQL
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-22-2008, 11:19 AM
Junior Member
 
Join Date: Dec 2008
Posts: 3
Default Running MySQL when OS boots up

Hi,

I want my MySQL running, when my operating system Mac OS X boots up. Is that a tedious job, can anybody provide me the simple steps to do this.

regards,

kayla
__________________
Kayla - Hosting
Reply With Quote
  #2 (permalink)  
Old 12-22-2008, 11:24 AM
Junior Member
 
Join Date: Dec 2008
Posts: 6
Default

Mac OS X automatically executes all scripts under the
/Library/StartupItems
directory when the system boots up.

If that directory does not yet exist, you will need to create it.

For MySQL, you should create the directory
/Library/StartupItems/MySQL
and place the startup shell script MySQL and the configuration file StartupParameters.plist in that directory.

Once those files are set up, you need to edit the host configuration file /etc/hostconfig
and add the line:

MYSQLSERVER=-YES-
1.2.3.1.1 MySQL
The shell script to start, stop, and restart MySQL looks like this:

#!/bin/sh

. /etc/rc.common

StartService( )
{
if [ "${MYSQLSERVER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Starting MySQL"
cd /usr/local/mysql
bin/mysqld_safe --user=mysql &
fi
}

StopService( )
{
ConsoleMessage "Stopping MySQL"
/usr/local/mysql/bin/mysqladmin shutdown
}

RestartService( )
{
if [ "${MYSQLSERVER:=-NO-}" = "-YES-" ]; then
ConsoleMessage "Restarting MySQL"
StopService
StartService
else
StopService
fi
}



StartupParameters.plist
The configuration file looks like this:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist SYSTEM "file://localhost/System/Library/

DTDs/PropertyList.dtd">



<plist version="0.9">

<dict>

<key>Description</key>

<string>MySQL Database Server</string>

<key>Provides</key>

<array>

<string>MySQL</string>

</array>

<key>Requires</key>

<array>

<string>Network</string>

</array>

<key>OrderPreference</key>

<string>Late</string>

</dict

></plist>


Once installed, you should run the mysql_install_db tool to set up your databases.
__________________
xunk in hosting

Last edited by xunk : 12-22-2008 at 11:42 AM.
Reply With Quote
  #3 (permalink)  
Old 12-22-2008, 11:45 AM
Junior Member
 
Join Date: Dec 2008
Posts: 4
Default

i want to set the same in my online server which is having linux OS and on my home pc which is having windows.
__________________
Emma Hosting
Reply With Quote
  #4 (permalink)  
Old 12-22-2008, 11:48 AM
Junior Member
 
Join Date: Dec 2008
Posts: 6
Default

In your online server which is having Linux OS, copy the script
mysql.server
from the source's support-files directory to your version of Linux startup directory and making sure it is executable by root.
Under FreeBSD, for example,
place this script in
/usr/local/etc/rc.d.

Once installed, you should run the mysql_install_db tool to set up your databases.

Windows 2000/XP
To startup an application at system startup on the Windows platform, you need to install it as a Windows service. You can do this by hand using the command:

C:\> c:\mysql\bin\mysqld-nt --install
A more convenient way to do accomplish this task is through the winmysqladmin.exe utility that comes with the Windows installation of MySQL.
__________________
xunk in hosting
Reply With Quote
  #5 (permalink)  
Old 12-22-2008, 11:51 AM
Junior Member
 
Join Date: Dec 2008
Posts: 5
Default

Well after starting the server, and before doing anything else, set a password for the root user:

mysqladmin -u root password a_good_password
__________________
Alyssa Dedicated Hosting
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 On
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 08:41 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0