PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : [Ubuntu] Problem mit MySQL-Server



monoton
21.06.05, 17:00
Hallo,

ich kriege den MySQL-Server nicht zum laufen, da ich mir aus Unahnung
selber das System ein bissel zermüllt habe.

Ich habe mit apt-get php-common installiert,
dann wollte ich mit apt-get mysql-server installieren, dabei bemängelte
er aber immer, das /etc/init.d/mysq fehlen würde, da auch nach
diversen apt-get remove php-common und apt-get remove mysql-server
der Fehler immer noch auftrat, hab ich kurzer Hand versucht
selber dieses fehlende Start-Script zu schreiben, was aber keinen
Erfolg brachte, der MySQL-Server lässt sich nun zwar installieren,
startet auch, bricht aber nach 30 Sekunden wieder ab.

Hier mein Script:



#!/bin/sh
case "$1" in
start)
echo "MySQL-Datenbankserver wird gestartet"
. /usr/bin/mysqld_safe &
;;
stop)
echo "MySQL-Datenbankserver wird heruntergefahren"
killall mysqld
;;
*)
echo "Usage: $0 {start|stop}"
exit 1
;;
esac
exit 0


Habt ihr vielleicht eine Idee, wie ich unter Ubuntu MySQL wieder
herrichten kann, ohne das gesamte System neu aufzuspielen?

Vielen Dank und Grüße

monoton

chrisi1698
21.06.05, 17:50
also ka ob das damit zu tun hat, aber bei vllt versuchst du es mal mit dem orginalen startscript, poste vllt auch mal das errorlogfile vom mysqld


#!/bin/sh
#
# mysql Starts the MySQL daemon
#
# chkconfig: - 74 26
# description: An SQL database engine.

# Source function library.
if [ -f /etc/init.d/functions ] ; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
else
STRING=$"MySQL: Could not find a functions file. The system seems broken."
echo -n "$STRING"
failure "$STRING"
echo
exit 1
fi

PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH

# Set some defaults, don't change them here, use /etc/my.cnf
datadir=/var/lib/mysql
sockdir=/var/run/mysql
basedir=
pid_file=



mode=$1 # start or stop

parse_arguments() {
for arg do
case "$arg" in
--basedir=*) basedir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--datadir=*) datadir=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
esac
done
}

# Get arguments from the my.cfg file, groups [mysqld] and [mysql_server]
if [ -x ./bin/my_print_defaults ] ; then
print_defaults="./bin/my_print_defaults"
elif [ -x $bindir/my_print_defaults ] ; then
print_defaults="$bindir/my_print_defaults"
elif [ -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 [ -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 [ -x "$d/bin/my_print_defaults" ] ; then
print_defaults="$d/bin/my_print_defaults"
break
fi
if [ -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
[ -z "$print_defaults" ] && print_defaults="my_print_defaults"
fi

parse_arguments `$print_defaults $defaults mysqld mysql_server`

if [ -z "$basedir" ] ; then
basedir=/usr
bindir=/usr/bin
else
bindir="$basedir/bin"
fi
if [ -z "$pid_file" ] ; then
pid_file=$datadir/`/bin/hostname`.pid
else
case "$pid_file" in
/* ) ;;
* ) pid_file="$datadir/$pid_file" ;;
esac
fi

# check for mysqld_safe
if [ ! -x "$bindir/mysqld_safe" ]; then
STRING=$"MySQL: mysql_safe is missing"
echo -n $STRING
skipped "$STRING"
echo
exit 5
fi

# no error yet
rc=0

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

# Start MySQL daemon
start () {
# Start daemon
STRING=$"Starting MySQL daemon: "
echo -n "$STRING"
[ -d ${sockdir:-/var/run/mysql} ] || mkdir -p ${sockdir:-/var/run/mysql}
chmod 755 ${sockdir:-/var/run/mysql}
chown mysql.mysql ${sockdir:-/var/run/mysql}

$bindir/mysqld_safe --datadir=$datadir --pid-file=$pid_file >& /dev/null &
rc=$?

if [ $rc = 0 ] ; then
success "$STRING"
[ -w ${INITLOCK:-/mnt/lockdev} ] && touch ${INITLOCK:-/mnt/lockdev}/mysql
else
failure "$STRING"
fi

echo
return $rc
}

# Stop daemon
stop () {
# Stop daemon. We use a signal here to avoid having to know the
# root password.
if [ -f "$pid_file" ] ; then
mysqld_pid=`cat $pid_file`
STRING=$"Stopping MySQL daemon: "
echo -n "$STRING"
kill $mysqld_pid

# mysqld should remove the pid_file when it exits, so wait for it.
sleep 1
count=0
while [ -s $pid_file -a $count -lt 34 ] ; do
echo -n "."
count=$(($count+1))
sleep 1
done
if [ -s $pid_file ] ; then
rc=1
failure "$STRING"
else
rc=0
success "$STRING"
fi
# delete lock
if [ -f ${INITLOCK:-/mnt/lockdev}/mysql ] ; then
rm ${INITLOCK:-/mnt/lockdev}/mysql
fi
else
STRING=$"No MySQL daemon pid file found. Looked for $pid_file."
echo -n "$STRING"
rc=1
failure "$STRING"
fi

echo
return $rc
}

# return status of MySQLd
status () {
if [ -f "$pid_file" ] ; then
mysqld_pid=`cat $pid_file`
if [ -d /proc/$mysqld_pid ] ; then
echo $"MySQL daemon is running with pid $mysqld_pid."
rc=0
else
echo $"MySQL daemon is not running, but pid file exists."
rc=1
fi
else
echo $"No MySQL daemon pid file found. Looked for $pid_file."
rc=1
fi

return $rc
}

case "$mode" in
start)
start
rc=$?
;;
stop)
stop
rc=$?
;;
restart)
stop
start
rc=$?
;;
status)
status
rc=$?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
rc=3
;;
esac

exit $rc

lg, chris

monoton
21.06.05, 18:12
Hallo,

habe das Configurationsfile kopiert, es als Datei mysql unter /etc/init.d/
abgelegt, und habe versucht mysql-server zu installieren.
Habe auch ein chmod 700 drauf gemacht.

Folgende Fehlermeldung habe ich bekommen:



Richte mysql-server ein (4.0.23-3ubuntu2) ...
MySQL: Could not find a functions file. The system seems broken./etc/init.d/mysql: line 16: failure: command not found

invoke-rc.d: initscript mysql, action "stop" failed.
MySQL: Could not find a functions file. The system seems broken./etc/init.d/mysql: line 16: failure: command not found

invoke-rc.d: initscript mysql, action "start" failed.
dpkg: Fehler beim Bearbeiten von mysql-server (--configure):
Unterprozess post-installation script gab den Fehlerwert 1 zurück
Fehler traten auf beim Bearbeiten von:
mysql-server
E: Sub-process /usr/bin/dpkg returned an error code (1)


Das File /var/log/mysql.err ist bei mir leer,
ebenso /var/log/mysql.log.

Dank und Gruß

monoton