Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
04-10-2006, 06:40 PM
|
#1
|
Member
Registered: Nov 2005
Posts: 123
Rep:
|
mysql.server startup script is not cooperating.
After creating a copy of mysql.server in my /etc/init.d directory and the appropriate symbolic links in /etc/rc*.d, MySQL will not run on startup. As a matter of fact, executing the script from the shell doesn't work either. It outputs
Code:
Starting MySQL.................................. *
This command:
Code:
$ sudo mysqld_safe --user=mysql
gets the server up and running with no problems. Any ideas?
|
|
|
04-10-2006, 06:44 PM
|
#2
|
Member
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48
Rep:
|
Check the log file for some errors. It may give you a clue.
|
|
|
04-10-2006, 06:56 PM
|
#3
|
LQ Newbie
Registered: Nov 2004
Location: Istanbul
Distribution: Slackware 10.2
Posts: 19
Rep:
|
try this command
Quote:
chmod 755 /etc/rc.d/rc.mysqld
|
|
|
|
04-10-2006, 07:05 PM
|
#4
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
Quote:
Originally Posted by ftenario
Check the log file for some errors. It may give you a clue.
|
Which log file are you referring to?
Quote:
Originally Posted by halitayarci
try this command
|
In my particular distribution, my /etc/rc.d is divided up by runlevels, as in rc0.d, rc1.d, ..., rc6.d. There is no single rc.d directory.
|
|
|
04-10-2006, 08:25 PM
|
#5
|
Senior Member
Registered: Sep 2003
Posts: 3,171
Rep:
|
You will find that all those rc#.d files have nothing in them but links. Probably you want to look in /etc/rc.d/init.d for the real startup scripts.
|
|
|
04-10-2006, 08:32 PM
|
#6
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
Quote:
Originally Posted by jiml8
You will find that all those rc#.d files have nothing in them but links. Probably you want to look in /etc/rc.d/init.d for the real startup scripts.
|
I've already added the appropriate links to the rc*.d directories (in this case, rc0.d and rc3.d) and linked them to where my real script resides: /etc/init.d/mysql.server.
Last edited by vmlinuz.gz; 04-10-2006 at 08:39 PM.
|
|
|
04-11-2006, 12:51 PM
|
#7
|
Member
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48
Rep:
|
The log file is usually in the data directory. It's called <hostname>.err
|
|
|
04-11-2006, 01:40 PM
|
#8
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
Well, it seems mysql.server cannot even access the server. After running the script, <hostname>.err doesn't show anything new happening, not even a connection attempt.
|
|
|
04-11-2006, 03:12 PM
|
#9
|
Member
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48
Rep:
|
Have you taken a look inside your mysql.server script? Try to find the "basedir" and "datadir" variables and verify that it it points to mysql in your system.
In my system, basedir=/usr/local/mysql/
It may vary in your system. Did u install mysql from source? If you did it from source, basedir is equal to your "--prefix=<path_to_your_mysql>" when you do the configure.
Or you can go to your mysql folder and run mysqld_safe from there to verify that it works.
Hope this helps
|
|
|
04-13-2006, 01:20 PM
|
#10
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
Initially, basedir= and datadir= were blank. Appending `/usr/local/mysql' and `/usr/local/mysql/data' didn't help. I verified that those were the correct directories, and they were. Running mysql.server while the system is up still won't work, but any other method of starting the MySQL server will. I used the binaries for the MySQL website.
Last edited by vmlinuz.gz; 04-13-2006 at 01:21 PM.
|
|
|
04-13-2006, 01:45 PM
|
#11
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
hmm. I tried starting up apache at boot time with no luck either. Perhaps I am doing something wrong. Here's what I've been doing.
1. Place the script (or a symbolic link to it) in /etc/init.d.
2. Place symbolic link to the script/link in /etc/init.d from /etc/rc0.d and /etc/rc3.d. I named them K01xxx in rc0.d and S99xxx in rc3.d.
Maybe this will help in determing the problem.
|
|
|
04-13-2006, 02:02 PM
|
#12
|
Member
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48
Rep:
|
The real scripts are in /etc/init.d/
The symbolic links (SXXxxxx) are in /etc/rc3.d assuming that you run in runlevel 3. If you run the GUI (kde or gnome), then the symbolic links should be in /etc/rc5.d
When troubleshooting like this, I always start by making the server work by hand first and not go to runlevel runs.
If you can run it manually, theres better chances of running automatically.
|
|
|
04-14-2006, 12:30 PM
|
#13
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
Right. I think a more logical way to go would be to determine what's wrong with the script, and then see how to get it started. I will post my mysql.server script. Maybe that will give so clues as to where the problem is originating.
Code:
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# MySQL daemon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.
# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.
# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO
# If you install MySQL on some other places than /usr/local/mysql, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
# [mysqld]
# basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
# and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
# below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.
# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.
basedir=/usr/local/mysql
datadir=/usr/local/mysql/data
# The following variables are only set for letting mysql.server find things.
# Set some defaults
pid_file=
server_pid_file=
use_mysqld_safe=1
user=mysql
if test -z "$basedir"
then
basedir=/usr/local/mysql
bindir=./bin
if test -z "$datadir"
then
datadir=/usr/local/mysql/data
fi
sbindir=./bin
libexecdir=./bin
else
bindir="$basedir/bin"
if test -z "$datadir"
then
datadir="$basedir/data"
fi
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
fi
#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
source $lsb_functions
else
log_success_msg()
{
echo " SUCCESS! $@"
}
log_failure_msg()
{
echo " ERROR! $@"
}
fi
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH
mode=$1 # start or stop
case `echo "testing\c"`,`echo -n testing` in
*c*,-n*) echo_n= echo_c= ;;
*c*,*) echo_n=-n echo_c= ;;
*) echo_n= echo_c='\c' ;;
esac
parse_server_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
bindir="$basedir/bin"
datadir="$basedir/data"
sbindir="$basedir/sbin"
libexecdir="$basedir/libexec"
;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--use-mysqld_safe) use_mysqld_safe=1;;
--use-manager) use_mysqld_safe=0;;
esac
done
}
parse_manager_arguments() {
for arg do
case "$arg" in
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}
wait_for_pid () {
i=0
while test $i -lt 35 ; do
sleep 1
case "$1" in
'created')
test -s $pid_file && i='' && break
;;
'removed')
test ! -s $pid_file && i='' && break
;;
*)
echo "wait_for_pid () usage: wait_for_pid created|removed"
exit 1
;;
esac
echo $echo_n ".$echo_c"
i=`expr $i + 1`
done
if test -z "$i" ; then
log_success_msg
else
log_failure_msg
fi
}
# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x ./bin/my_print_defaults
then
print_defaults="./bin/my_print_defaults"
elif test -x $bindir/my_print_defaults
then
print_defaults="$bindir/my_print_defaults"
elif test -x $bindir/mysql_print_defaults
then
print_defaults="$bindir/mysql_print_defaults"
else
# Try to find basedir in /etc/my.cnf
conf=/etc/my.cnf
print_defaults=
if test -r $conf
then
subpat='^[^=]*basedir[^=]*=\(.*\)$'
dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
for d in $dirs
do
d=`echo $d | sed -e 's/[ ]//g'`
if test -x "$d/bin/my_print_defaults"
then
print_defaults="$d/bin/my_print_defaults"
break
fi
if test -x "$d/bin/mysql_print_defaults"
then
print_defaults="$d/bin/mysql_print_defaults"
break
fi
done
fi
# Hope it's in the PATH ... but I doubt it
test -z "$print_defaults" && print_defaults="my_print_defaults"
fi
#
# Read defaults file from 'basedir'. If there is no defaults file there
# check if it's in the old (depricated) place (datadir) and read it from there
#
extra_args=""
if test -r "$basedir/my.cnf"
then
extra_args="-e $basedir/my.cnf"
else
if test -r "$datadir/my.cnf"
then
extra_args="-e $datadir/my.cnf"
fi
fi
parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`
# Look for the pidfile
parse_manager_arguments `$print_defaults $extra_args manager`
#
# Set pid file if not given
#
if test -z "$pid_file"
then
pid_file=$datadir/mysqlmanager-`/bin/hostname`.pid
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_file" ;;
esac
fi
if test -z "$server_pid_file"
then
server_pid_file=$datadir/`/bin/hostname`.pid
else
case "$server_pid_file" in
/* ) ;;
* ) server_pid_file="$datadir/$server_pid_file" ;;
esac
fi
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
'start')
# Start daemon
manager=$bindir/mysqlmanager
if test -x $libexecdir/mysqlmanager
then
manager=$libexecdir/mysqlmanager
elif test -x $sbindir/mysqlmanager
then
manager=$sbindir/mysqlmanager
fi
echo $echo_n "Starting MySQL"
if test -x $manager -a "$use_mysqld_safe" = "0"
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 &
wait_for_pid created
# Make lock for RedHat / SuSE
if test -w /var/lock/subsys
then
touch /var/lock/subsys/mysqlmanager
fi
elif test -x $bindir/mysqld_safe
then
# Give extra arguments to mysqld with the my.cnf file. This script
# may be overwritten at next upgrade.
pid_file=$server_pid_file
$bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file >/dev/null 2>&1 &
wait_for_pid created
# Make lock for RedHat / SuSE
if test -w /var/lock/subsys
then
touch /var/lock/subsys/mysql
fi
else
log_failure_msg "Couldn't find MySQL manager or server"
fi
;;
'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.
# The RedHat / SuSE lock directory to remove
lock_dir=/var/lock/subsys/mysqlmanager
# If the manager pid_file doesn't exist, try the server's
if test ! -s "$pid_file"
then
pid_file=$server_pid_file
lock_dir=/var/lock/subsys/mysql
fi
if test -s "$pid_file"
then
mysqlmanager_pid=`cat $pid_file`
echo $echo_n "Shutting down MySQL"
kill $mysqlmanager_pid
# mysqlmanager should remove the pid_file when it exits, so wait for it.
wait_for_pid removed
# delete lock for RedHat / SuSE
if test -f $lock_dir
then
rm -f $lock_dir
fi
else
log_failure_msg "MySQL manager or server PID file could not be found!"
fi
;;
'restart')
# Stop the service and regardless of whether it was
# running or not, start it again.
$0 stop
$0 start
;;
'reload')
if test -s "$server_pid_file" ; then
mysqld_pid=`cat $server_pid_file`
kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
touch $server_pid_file
else
log_failure_msg "MySQL PID file could not be found!"
fi
;;
*)
# usage
echo "Usage: $0 start|stop|restart|reload"
exit 1
;;
esac
The instructions say that it should be put in rc3.d; but I will try rc5.d after I get it working if you believe that would help.
|
|
|
04-14-2006, 12:49 PM
|
#14
|
Member
Registered: Jul 2003
Location: Camarillo, CA
Distribution: Debian
Posts: 48
Rep:
|
I'm out of ideas.
Probably a few more steps:
run mysql from /usr/local/mysql/bin/mysqld_safe
See if it runs. If it does, then more likely it's you mysql.server script. How about the permission of mysql.server? It should be executable.
Check the owner of your mysql installation folder and the rest below it. It should be own by mysql user and mysql group
You must also have these tables /usr/local/mysql/data/mysql/<tables> where <tables> are mysql system tables
|
|
|
04-14-2006, 10:41 PM
|
#15
|
Member
Registered: Nov 2005
Posts: 123
Original Poster
Rep:
|
We are making progress. Mysql.server was originally owned by root. It will now run, but only if I'm logged in as the mysql user.
EDIT: Actually, mysql.server will run (only as the `mysql' user) regardless of permissions; i.e. I changed the owner/group to my personal user account and it still ran when I was logged in as mysql.
EDIT2: The following command:
Code:
$ sudo ./mysql.server start --user=mysql
works as well. It seems, then, that our objective would be to get the script to run as mysql.
EDIT3: Moving the symbolic link from rc3.d to rc5.d did not make a difference.
Last edited by vmlinuz.gz; 04-14-2006 at 11:23 PM.
|
|
|
All times are GMT -5. The time now is 10:46 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|