Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Jun 29, 2009, 02:39 AM   #1
NRose8989
macrumors 6502a
 
Join Date: Feb 2008
Making a script to start and stop mySQL.

I manually installed mySQL 5.1 so I can't use the pref pane that I would normally get when installing mySQL as a installer package. So I would like to make two scripts (".start" and ".stop") that will live in my home folder, so I can quickly start and stop them when open terminal. I kinda have an idea on how to make it but I don't know how to have the script enter my admin password when it is prompted (or if thats even possible).

the two commands to start and stop it are as follows:

to start:
Code:
sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
to stop:
Code:
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
Thanks in advance.

EDIT: Nevermind I think I figured it out, Just had to change some permissions.

EDIT #2: So they work just fine but now I have that natural feeling to make it better. I currently have two scripts, one for starting, and one for stopping. How would I go about rolling them into one single script called ".mysql" and it will test if the mySQL server is already running (or not running) then execute the needed command. Do any of you know what is returned if one of these commands failed to execute?

I would think that I could use
Code:
test
and a series of if statements, assuming if the commands returned a integer.

any ideas?

Last edited by NRose8989; Jun 29, 2009 at 03:07 AM.
NRose8989 is offline   0 Reply With Quote
Old Jun 29, 2009, 03:43 AM   #2
BertyBoy
macrumors 6502
 
Join Date: Feb 2009
Why can't you use the pref pane to start / stop MySQL ?

All it does will be to call mysqld_safe ? wherever that happens to be in your PATH.
BertyBoy is offline   0 Reply With Quote
Old Jun 29, 2009, 03:13 PM   #3
NRose8989
Thread Starter
macrumors 6502a
 
Join Date: Feb 2008
Ya the pref panes doesn't work because I followed this tutorial and it doesn't work, not sure why but it doesn't.

I did it this way because the mySQL install packages didn't work when using ruby on rails.
NRose8989 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Help making Bash Script work with Lion? Yujenisis Mac Programming 4 Sep 13, 2011 02:57 PM
AT&T rep on facebook said we can keep unlimited plan and start and stop IpadEric iPad 72 Jun 8, 2010 03:18 PM
Power Mac G5 Start and Stop Fan Annoyance desenso Macintosh Computers 1 Oct 24, 2005 05:11 PM
Making an app start and stop automatically jestershinra Mac Applications and Mac App Store 1 Nov 26, 2004 03:27 AM
Recommend me a good book to start learning PHP/MySQL edesignuk Web Design and Development (archive) 14 Nov 10, 2004 07:17 PM


All times are GMT -5. The time now is 05:16 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC