Linux ’service’ command

April 30th, 2010

It seems some Distributions of Linux don't include the 'service' command. Unfortunately, many great Tutorials assume this command is available, and use it for things like stopping and starting Apache, etc.

Luckily, it's a pretty simple script, and something you can easily create yourself. I use the nano text editor here, but feel free to replace 'nano -w' with 'vi' or whatever your preferred text editor is.

# nano -w /usr/sbin/service

In your Text Editor, enter this text:

#!/bin/sh
set -e
/etc/init.d/$1 $2 $3

Save the file, and then...

# chmod 755 /usr/sbin/service

This makes service an executable file.

Now you'll be able to do things like:

service httpd restart
service mysqld stop

easily!

 
 

MySQL Root Password Reset (Linux)

April 28th, 2010

I ran into a case earlier today where I was setting up a LAMP (Linux, Apache, MySQL, PHP) Server whcih already had most of these components pre-installed.  However, no one was really sure what the MySQL Root User password was - and there clearly was one, as attempts to connect without it failed.

The obvious answer was to reset the Root user password - the method of doing so was less obvious.

First, you need to stop the running mysqld daemon.  First try:

# /etc/init.d/mysqld stop

If that doesn't work for any reason, try this sequence:
Read the rest of this entry »

 

Musings on Coding, Gaming, and Life in General
Loading...