Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL doesn't start on it's own when Linux boots. Help! 2

Status
Not open for further replies.

JustKIDn

MIS
May 6, 2002
386
US
Hi all,

I've looked every where for this.

MySQL doesn't start on it's own when Linux boots.

I have the Caldera OpenLinux and I just upgraded MySQL from 3.22x to 4.0.12 with the rpm.

It never started on it's own with the older version. And I was hoping it would be corrected with the new version.

MySQL is installed correctly and works fine if I start it with mysqld_safe or mysqld.

mysql.server did get installed ok into the /etc/rc.d/init.d directory. But I think there maybe is supposed to be something else. There are no references to mysql in any of the other files or directories under /rc.d and I don't know how to if that's what it takes.

I found the starting and stopping on boot docs on mysql.com. So I know it's mostly configured correctly. They mention a command to run to get it setup to start on boot. But that file doesn't seem to exist on my Linux.

Can you help?

If you need more info, let me know.

Thanks again for the help.

tgus

____________________________
Families can be together forever...
 
Hi sleipnir,

No, I looked in /etc/rc.d/rc3.d and all the other directories under /etc/rc.d and the only thing I can find that starts with 'my' is /etc/rc.d/init.d/mysql.server

Can you tell me how to fix this?

Is there supposed to be a start command and a stop command put somewhere?

Thanks



tgus

____________________________
Families can be together forever...
 
If you preform a "ls -l" in /etc/rc.d/rc3.d, you will see that all the entries in that directory are symboli links to entries /etc/rc.d/init.d

Just create a link beginning with a capital S and two digits to the script in /etc/rc.d/init.d

Something like:

ln -s ../init.d/mysql.server S75mysql

Want the best answers? Ask the best questions: TANSTAAFL!
 
Hi sleipnir,

I've never made a symbolic link before.

Can you clarify that?

What does the number mean? Does the number need to be unique?

Here is an example of a symbolic link in my rc3.d;
S91samba -> ../init.d/samba

But I see that my example is backwards of yours. Does that matter?

What is;
In -s ?

Thanks.

tgus

____________________________
Families can be together forever...
 
Not "In", "ln" as in "ell en".

Issue "ln --help" to get more information, "man ln" for still more.

Assume runlevel 3. At boot, the init process will start all scripts that begin with "S", in the order of the two-digit numbers. This gives you the ability to tailor the startup of apps so that you can start a particular daemon after the scripts which set up services or facilities it needs. For example, starting MySQL after your network setup script runs.

Want the best answers? Ask the best questions: TANSTAAFL!
 
sleipnir,

Great answer!

I looked up help for ln and got a better handle on it.

It worked perfectly. I ran your command, and checked it after and there was a symbolic link for mysql.

But I must have missed something. After I added the symbolic link, I rebooted Linux. Once it was up again, I telneted into it again, and ran 'mysql -u root' and got the error about couldn't connect. I did ps -A and there was no reference to mysql at all.

What did I do wrong?


tgus

____________________________
Families can be together forever...
 
Dunno. I assumed /etc/rc.d/rc3.d because I assumed you were running in runlevel 3. You may be running in another runlevel -- for example, have you set up Linux to boot with the GUI? If so, you're running under runlevel 5.

If you are running Linux in another runlevel, then you'll have to add the link to the appropriate /etc/rc.d/rcX.d directory.

Want the best answers? Ask the best questions: TANSTAAFL!
 
sleipnir,

Thanks for all your help.

I don't know what I'm going to do. After your last post, I tried it in /rc5.d and then did 'shutdown -r now'. After the reboot I tried it again. Still didn't work.

So I added it to all 6 of them.

After changing to the correct directory each time. This is the command I used;

ln -sv ../init.d/mysql.server S99mysql

I changed it to 99 because in the comments in mysql.server it said that it's usually set to 99.

This is what a find looks like;

rc.d]# find /etc/rc.d/ -name *mysql*
/etc/rc.d/init.d/mysql.server
/etc/rc.d/rc2.d/S99mysql
/etc/rc.d/rc3.d/S99mysql
/etc/rc.d/rc4.d/S99mysql
/etc/rc.d/rc5.d/S99mysql
/etc/rc.d/rc0.d/S99mysql
/etc/rc.d/rc1.d/S99mysql

This is what ls -lah looks like;

rc.d]# ls -lah /etc/rc.d/*/*mysql*
-rwxr-xr-x 1 root root 2.7k Apr 8 23:14 /etc/rc.d/init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 22 10:02 /etc/rc.d/rc0.d/S99mysql -> ../init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 22 10:03 /etc/rc.d/rc1.d/S99mysql -> ../init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 22 10:04 /etc/rc.d/rc2.d/S99mysql -> ../init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 21 14:09 /etc/rc.d/rc3.d/S99mysql -> ../init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 22 10:04 /etc/rc.d/rc4.d/S99mysql -> ../init.d/mysql.server
lrwxrwxrwx 1 root root 22 Apr 22 09:30 /etc/rc.d/rc5.d/S99mysql -> ../init.d/mysql.server

I show you all this for two reasons;
1.) so you can see if I made any mistakes.

2.) so anyone else who sees this thread might learn from it.

So if you can, please tell me what I did wrong, or what I missed.

What if I changed the path from ../init.d/mysql.server to /etc/rc.d/init.d/mysql.server

Thanks again!

tgus

____________________________
Families can be together forever...
 
sleipnir,

o.k. thanks for all the help!

I'll go post it now, and I'll include a link to this thread.


tgus

____________________________
Families can be together forever...
 
sleipnir,

In case you want to follow along or curious to see if there are any results on this.

This is the thread54-531593 in the Linux Server forum.

So far no results, but by the time you see this maybe there will be. Up to now we've determined that mysql.server in the init.d directory won't run. (command not found)

Thanks again for you help!

tgus

____________________________
Families can be together forever...
 
I just paid attention to the title of that other thread....

<whispered aside>
One thing to know so that you fit in with the Linux geeks better. On Win32, they're called &quot;services&quot;. On Linux, they're called &quot;daemons&quot;.
</whispered aside>

Want the best answers? Ask the best questions: TANSTAAFL!
 
<whispered aside>
Oh yeah, I forgot! Thanks for the reminder.
I was sure I've seen posts where it was called services. I guess I got confused.

BTW: thanks for whispering so no one could hear us! [bigears]
</whispered aside>

Do you think that the fact that I'm using InnoDB databases makes any difference?

I found that the only way I can start mysql, is to use mysqld.

Is there a way to start mysqld with options at boot-up?

Or is there a better way?

tgus

____________________________
Families can be together forever...
 
No! This is what I got;

/]# /etc/rc.d/init.d/mysql.server start
/]# Starting mysqld daemon with databases from /var/lib/mysql
030423 23:18:25 mysqld ended

I don't get it!


tgus

____________________________
Families can be together forever...
 
Hi Everyone here,

I have also been following this post around different forums.

I think Tgus should have a look at the content of mysql.server script to check what that script is looking for to start the daemon. Maybe basedir(s) are not correct or some other setting.

Just a thought


Bye

Qatqat

The reason why my girlfriend can read my thoughts is because mine are properly written! (G.Lepore)
 
You're right QatQat,

Here it is;

init.d]# more mysql.server
#!/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. When this is done
# the mysql server will be started when the machine is started.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 90 90
# description: A very fast and reliable SQL database engine.

PATH=/sbin:/usr/sbin:/bin:/usr/bin
basedir=/
bindir=/usr/bin
datadir=/var/lib/mysql
pid_file=/var/lib/mysql/mysqld.pid
mysql_daemon_user=mysql # Run mysqld as this user.
export PATH

mode=$1

if test -w / # determine if we should look at the root config file
then # or user config file
conf=/etc/my.cnf
else
conf=$HOME/.my.cnf # Using the users config file
fi

# The following code tries to get the variables safe_mysqld needs from the
# config file. This isn't perfect as this ignores groups, but it should
# work as the options doesn't conflict with anything else.

if test -f &quot;$conf&quot; # Extract those fields we need from config file.
then
if grep &quot;^datadir&quot; $conf >/dev/null
then
datadir=`grep &quot;^datadir&quot; $conf | cut -f 2 -d= | tr -d ' '`
fi
if grep &quot;^user&quot; $conf >/dev/null
then
mysql_daemon_user=`grep &quot;^user&quot; $conf | cut -f 2 -d= | tr -d ' ' | head -1`
fi
if grep &quot;^pid-file&quot; $conf >/dev/null
then
pid_file=`grep &quot;^pid-file&quot; $conf | cut -f 2 -d= | tr -d ' '`
else
if test -d &quot;$datadir&quot;
then
pid_file=$datadir/`hostname`.pid
fi
fi
if grep &quot;^basedir&quot; $conf >/dev/null
then
basedir=`grep &quot;^basedir&quot; $conf | cut -f 2 -d= | tr -d ' '`
bindir=$basedir/bin
fi
if grep &quot;^bindir&quot; $conf >/dev/null
then
bindir=`grep &quot;^bindir&quot; $conf | cut -f 2 -d=| tr -d ' '`
fi
fi


# Safeguard (relative paths, core dumps..)
cd $basedir

case &quot;$mode&quot; in
'start')
# Start daemon

if test -x $bindir/safe_mysqld
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$bindir/safe_mysqld --user=$mysql_daemon_user --pid-file=$pid_file --datad
ir=$datadir &
else
echo &quot;Can't execute $bindir/safe_mysqld&quot;
fi
;;

'stop')
# Stop daemon. We use a signal here to avoid having to know the
# root password.
if test -f &quot;$pid_file&quot;
then
mysqld_pid=`cat $pid_file`
echo &quot;Killing mysqld with pid $mysqld_pid&quot;
kill $mysqld_pid
# mysqld should remove the pid_file when it exits.
else
echo &quot;No mysqld pid file found. Looked for $pid_file.&quot;
fi
;;

*)
# usage
echo &quot;usage: $0 start|stop&quot;
exit 1
;;
esac

I didn't see anything that looked obvious except maybe that it is calling 'safe_mysqld' instead of 'mysqld_safe'.

That doesn't really matter though, I tried to run both of them and neither one works.

<get on soapbox>
If this was a decent board, (like phpBB or something)I could have just uploaded the file for you to see complete (like file date/time etc...). Then you could just download it from the link. This file isn't so bad, but what if it was a really BIG file.
</get on soapbox>
[soapbox]

Maybe I should just Uninstall MySQL with RPM and then try again? I don't have any databases to save yet. But if I ever get this worked out I will.

Will Uninstalling with RPM remove everything of MySQL including the old version and 4.x?

tgus

____________________________
Families can be together forever...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top