Web Hosting Talk







View Full Version : mySQL and cobalts....


Kate_C
07-02-2001, 12:31 AM
I purchased a raq 4 from rackshack and installed mySQL etc. It seemed to be going fine untill these problems of connection errors.

I determind that it the max connection=100 variable in mySQL. The thing is how do I edit is variable?

Please Please help me!

Thank you

CJCS
07-02-2001, 12:59 AM
Good morning kate,

try to start mysqld with --set-variable max_connections=xxx where xxx are the maximum connections you would like to have. Some other usefull startup options are --set-variable interactive_timeout=300 --set-variable wait_timeout=60. With this settings your mysql server drops the "old" connections faster.

You had to edit /etc/rc.d/init.d and then the file which belongs to the mysql daemon. I've never installed the Cobalt MySQL Package so I don't know which filename it is. Somewhere in this file the safe_mysqld script is started.

If the line is named /usr/local/libexec/safe_mysqld & then change the line to this /usr/local/libexec/safe_mysqld --set-variable max_connections=250 --set-variable interactive_timeout=300 --set-variable wait_timeout=60 &

Another good option for the Cobalt box is the --safe-show-database. If a user enters the command "show database" the system will normaly show all databases on the system. If you start mysqld with this line, the system will show the user only the databases on which the user has rights.

Take a look at this thread also, i've posted something about "tuning" mysql. http://www.webhostingtalk.com/showthread.php?s=&threadid=13480

Please note that you possibly void your cobalt warranty if you make changes to the system.

Greetings
Oliver Schlag

P.S. For more mysql Command Line Options take a look at http://www.mysql.com/doc/C/o/Command-line_options.html

Kate_C
07-02-2001, 01:09 AM
Hello again.

Thank you for the relpy. I tried what you stated and got the following:

[root /root]# mysqld --set-variable max_connections=130
010702 6:00:51 Can't start server: Bind on TCP/IP port: Address already in use
010702 6:00:51 Do you already have another mysqld server running on port: 3306
?
010702 6:00:51 Aborting

010702 6:00:51 mysqld: Shutdown Complete

Kate_C
07-02-2001, 01:26 AM
I CD to the dir you told me. then: pico mysql

It came up with the mySQL demon file and I did a search for the "/usr/local/libexec/safe_mysqld" It said not found....

:(

CJCS
07-02-2001, 01:33 AM
Hy kate,

i've done a little research (and installed the cobalt package in another subdir to take a look at it)

The file is named /etc/rc.d/init.d/mysql and you should change it to look like the following :


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


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

case "$mode" 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 --datadir=$datadir --set-variable max_connections=250 --set-variable interactive_timeout=300 --set-variable wait_timeout=60 &

else
echo "Can't execute $bindir/safe_mysqld"
fi
;;

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

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


The red line is the important line which you had to change. After this make a /etc/rc.d/init.d/mysql stop and then a /etc/rc.d/init.d/mysql start.

This should work.
But keep in mind what cobalt says about changing the system files.

NOTE: UNSUPPORTED. Cobalt Networks currently does not offer support for third party software or modified systems. Please contact the appropriate software vendor for further assistance. Modifications through root shell access could potentially void your warranty. A fee will be assessed by Cobalt for fixes or rebuilds on systems with unsupported modifications.


Greetings
Oliver Schlag

Pingu
07-02-2001, 09:20 AM
When MySQL starts it reads settings from /etc/my.cnf
If that file isn't there, it just starts with default settings.

So if you want to change settings, either edit the my.cnf, or make a new one, and restart MySQL once you're done with that file :)

Kate_C
07-02-2001, 01:02 PM
[QUOTE]Originally posted by Pingu
When MySQL starts it reads settings from /etc/my.cnf
If that file isn't there, it just starts with default settings.

So if you want to change settings, either edit the my.cnf, or make a new one, and restart MySQL once you're done with that file :) [/QUOTE

I do not have that file.

If i was to create one what do i put in it?

Thank you.

huck
07-02-2001, 03:14 PM
Kate,
Check you mysql installation directory -- somewhere in there will be an example of my.cnf. You can use it as a guide. There are several of them depending upon the usage of the machine and how much memory your machine has. I would consider installing 256MB or more of RAM if you are using MySQL a lot and us the appropriate my.cnf. If you do not have the *.cnf files, download the mysql source and untar it -- they will be in there.

highlander
07-02-2001, 03:20 PM
I went looking for the my.cnf file too and didn't find it.

In the /usr/doc/MySQL-3.23.37 folder though I do have four files called my-huge.cnf, my-large.cnf, my-medium.cnf and my-small.cnf.

I am sure that you will find one of these matches your needs with a little tweeking.

Robert

Kate_C
07-04-2001, 07:56 PM
I still am stuck on this! Ohhh well i will just have to reboot mySQL once in a while till I can learn how to do more admin work. Thanks guys.

CJCS
07-05-2001, 01:31 AM
Hy kate,

the my.cnf File is very bad documented (or i haven`t found it). Try to create a my.cnf file in the dir /etc and then put the following into it :


[mysqld]
set-variable = max_connections=250
set-variable = interactive_timeout = 300
set-variable = wait_timeout = 60


I think this will work. Let me know.

Greetings
Oliver