FS#12953 - Can't start mysqld
Attached to Project:
Arch Linux
Opened by João Vieira (Vieira) - Sunday, 25 January 2009, 00:32 GMT
Last edited by Hugo Doria (hdoria) - Wednesday, 29 April 2009, 11:35 GMT
Opened by João Vieira (Vieira) - Sunday, 25 January 2009, 00:32 GMT
Last edited by Hugo Doria (hdoria) - Wednesday, 29 April 2009, 11:35 GMT
|
Details
Description:
After updating mysql to 5.0.75-2 it fails to start. However running sudo /usr/bin/mysqld_safe --datadir=/var/lib/mysql correctly starts mysql so the problem is probably in the rc.d/mysqld script. Additional info: * mysql 5.0.75-2 * problem is probably in the /etc/rc.d/mysqld file. Steps to reproduce: 1) run sudo /etc/rc.d/mysqld start. 2) check that it fails to start. |
This task depends upon
Version that works vs version that doesn't (the latest one doesn't work).
Other users are experiencing the same problem as reported on the forums: http://bbs.archlinux.org/post.php?tid=63694
Yes, it was tested - just running /etc/rc.d/mysqld start and stop. I did not tested with a reboot.
Anyway, with the new pidof tests, i was not using the hostname.pid file on startup.
Another thing, mysql WAS starting. Just reboot you system, you will see that it FAIL, but when you do "mysql" in the prompt it works.
Anyway, i just uploaded a new mysql package that hopefully fixes this problems.
Thanks
it still shows that Mysqld fails on boot. The but ps -aux shows it is running.
$sudo pacman -Q mysql
mysql 5.0.75-3
$ ps -aux | grep mysql
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
root 2157 0.0 0.2 2824 1328 ? S 14:16 0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql
mysql 2199 0.0 3.7 126892 19496 ? Sl 14:16 0:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/lib/mysql/production-arch.pid --skip-external-locking --port=3306 --socket=/tmp/mysql.sock
Any ideas?
Bertil B
Anyways here's a daemon script that kind of incorporates some of the changes
and works for me.
script. This is the same reason it broke last time. Please stop breaking it!
My previously posted daemon script from Thursday, 29 January 2009 should work fine.
Thanks.
[1] http://repos.archlinux.org/viewvc.cgi/mysql/repos/extra-i686/mysqld?r1=25814&r2=27681
Thanks for the kindness with this bug report. In fact, i really like to break mysql because i recommend SQL Server, so nothing better for make the users switch to Microsoft than break mysql...
Stop joking, i tested this latest version and is was starting MYSQL here, did you change your hostname ? Did you had some problem that your hostname changed ?
Just for your knowledge, this was the problem that is trigguering this one here:
http://bugs.archlinux.org/task/12798?string=mysql&project=1&search_name=&type[0]=&sev[0]=&pri[0]=&due[0]=&reported[0]=&cat[0]=&status[0]=&percent[0]=&opened=&dev=&closed=&duedatefrom=&duedateto=&changedfrom=&changedto=&openedfrom=&openedto=&closedfrom=&closedto=
So, i was just trying to solve this problem and im reverting to the latest state until a new solution appers.
Thanks and dont take me serious, i just dont thing that you needed to use such words in a ticket, just point the problem and i will fix it asap.
this is basically the output from the initscript:
:: Starting MySQL + printf '\033[s'
+ deltext
+ printf '\033[107G'
+ printf ' \033[1;34;40m[\033[0;36;40mBUSY\033[1;34;40m]\033[1;0m '
[BUSY] ++ getPID
++ '[' -f /var/lib/mysql/archie.pid ']'
+ '[' -z '' ']'
+ /usr/bin/mysqld_safe --datadir=/var/lib/mysql
+ '[' 0 -gt 0 ']'
+ sleep 1
++ getPID
++ '[' -f /var/lib/mysql/archie.pid ']'
+ '[' -z '' ']'
+ stat_fail
+ deltext
+ printf '\033[107G'
+ printf ' \033[1;34;40m[\033[1;31;40mFAIL\033[1;34;40m]\033[1;0m \n'
[FAIL]
+ exit 1
get_mysql_option(){
result=`/usr/bin/my_print_defaults "$1" | sed -n "s/^--$2=//p" | tail -n 1`
if [ -z "$result" ]; then
# not found, use default
result="$3"
fi
}
get_mysql_option mysqld datadir "/var/lib/mysql"
datadir="$result"
get_mysql_option mysqld socket "$datadir/mysql.sock"
socketfile="$result"
get_mysql_option mysqld_safe log-error "/var/log/mysqld.log"
errlogfile="$result"
get_mysql_option mysqld_safe pid-file "/var/run/mysqld/mysqld.pid"
mypidfile="$result"
maybe this will help, i suggest looking at their initscript in detail as it doesn't make many assumptions and does not rely on pidof.
After boot happened the script says "DONE" if I try to restart mysql. I've tracked down the problem to this code :
stat_busy "Starting MySQL"
if [ -z "$(getPID)" ]; then
/usr/bin/mysqld_safe --datadir=$MYSQLD_ROOT &>/dev/null &
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
sleep 1 # wait on children <--- THIS IS THE PROBLEMATIC PART
if [ -z "$(getPID)" ]; then
stat_fail
exit 1
else
The problem for me resides in the "sleep 1" waiting for mysqld_safe children (that is mysqld) to be too short. Increasing it to "5" solves my problem and I get "DONE" correctly. Probably the system at boot is busy in other things and can't startup mysql that fast in every occasion. Maybe a safer sleep value (At least 2 or maybe 3, I tried 5 , but probably a lower one should do anyway) should be placed there.
Bye
Marcello
mysqladmin -uUNKNWN_USER ping and grepped for a Access for user denied. Once that was the case it was aware of msyql being up and completed the initialization.
In arch if you just do a mysqladmin ping it'll respond with 'mysql is alive' so that is another avenue. The above was wrapped in a for loop with a timeout of 30 seconds so that should be more than enough time to verify that mysql is started.
case "$1" in
start)
stat_busy "Starting MySQL"
if [ -z "$(getPID)" ]; then
/usr/bin/mysqld_safe --datadir=$MYSQLD_ROOT &>/dev/null &
if [ $? -gt 0 ]; then
stat_fail
exit 1
else
timeo=30
while [ $timeo -gt 0 ]; do
response=`/usr/bin/mysqladmin -uUNKNOWN_USER ping 2>&1` && break
echo "$response" | grep -q "mysqld is alive" && break
sleep 1
let timeo=${timeo}-1
done
if [ $timeo -eq 0 ]; then
stat_fail
exit 1
else
echo $(getPID) >/var/run/mysqld.pid
add_daemon mysqld
stat_done
fi
fi
else
stat_fail
exit 1
fi
;;
that are the differences between 5.0.77-2 and 5.0.77-3
Thanks
Also, perhaps we should move the TIMEOUT value to a conf.d file to make this configurable