LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-03-2004, 08:04 PM   #1
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Rep: Reputation: 32
mysql error on boot up


can any one tell me were to add the command please

Quote:
noticed the same startup problems only after I assigned a password to the mysql root user. The problem is in the mysqladmin ping command in the mysql startup script, it apparently doesn't work after assigning the root user a password. So I modified the script and in the mysqladmin ping commands added the "-u root -p 'password' " and the script works fine now. Thats not the best solution but does seem to work.
Os is Fedora Core 1 /etc/init.d


Code:
#!/bin/bash
#
# mysqld	This shell script takes care of starting and stopping
#		the MySQL subsystem (mysqld).
#
# chkconfig: - 78 12
# description:	MySQL database server.
# processname: mysqld
# config: /etc/my.cnf
# pidfile: /var/run/mysqld/mysqld.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network


prog="MySQL"

datadir="/var/lib/mysql"

start(){
	touch /var/log/mysqld.log
	chown mysql.mysql /var/log/mysqld.log 
	chmod 0640 /var/log/mysqld.log
	if [ ! -d $datadir/mysql ] ; then
	    action $"Initializing MySQL database: " /usr/bin/mysql_install_db
	    ret=$?
	    chown -R mysql.mysql $datadir
	    if [ $ret -ne 0 ] ; then
	    	return $ret
	    fi
	fi
	chown -R mysql.mysql $datadir
	chmod 0755 $datadir
	/usr/bin/safe_mysqld  --defaults-file=/etc/my.cnf >/dev/null 2>&1 &
	ret=$?
        # Spin for a maximum of ten seconds waiting for the server to come up
	if [ $ret -eq 0 ]; then
            for x in 1 2 3 4 5 6 7 8 9 10; do
            if [ -n "`/usr/bin/mysqladmin ping 2> /dev/null`" ]; then
                    break;
            else
                    sleep 1;
            fi
            done
            if !([ -n "`/usr/bin/mysqladmin ping 2> /dev/null`" ]); then
                    echo "Timeout error occurred trying to start MySQL Daemon."
                    action $"Starting $prog: " /bin/false
            else
                    action $"Starting $prog: " /bin/true
            fi
	else
    	    action $"Starting $prog: " /bin/false
	fi
	[ $ret -eq 0 ] && touch /var/lock/subsys/mysqld
	return $ret
}

stop(){
        /bin/kill `cat /var/run/mysqld/mysqld.pid  2> /dev/null ` > /dev/null 2>&1
	ret=$?
	if [ $ret -eq 0 ]; then
	    action $"Stopping $prog: " /bin/true
	else
    	    action $"Stopping $prog: " /bin/false
	fi
	[ $ret -eq 0 ] && rm -f /var/lock/subsys/mysqld
	[ $ret -eq 0 ] && rm -f $datadir/mysql.sock
	return $ret
}
 
restart(){
    stop
    start
}

condrestart(){
    [ -e /var/lock/subsys/mysqld ] && restart || :
}

# See how we were called.
case "$1" in
  start)
    start
    ;;
  stop)
    stop
    ;;
  status)
    status mysqld
    ;;
  restart)
    restart
    ;;
  condrestart)
    condrestart
    ;;
  *)
    echo $"Usage: $0 {start|stop|status|condrestart|restart}"
    exit 1
esac

exit $?
TT
 
Old 02-03-2004, 09:03 PM   #2
tommytomato
Member
 
Registered: Nov 2003
Location: Narrogin Western Australia
Distribution: GUI Ubuntu 12.04 - Server 12.04.4 LTS
Posts: 939

Original Poster
Rep: Reputation: 32
Hi just an updated.

I got this from a mate

Quote:
Its not good to put password on the command line cause then it appears in the environment for that program and thusly can be seen/copied for use by hackers.

You can see this for yourself by typing 'ps aufxww' on the cmd line.

any other ideas please.

TT
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. NoviceW Linux - Networking 17 09-17-2014 03:13 PM
ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. suziecorbett Linux - Software 8 10-09-2008 02:52 AM
Starting MySQL OLD Error : imeout error occurred trying to start MySQL Daemon Fr33B5D Linux - Software 9 10-28-2006 07:23 AM
mysql error Can't connect to local MySQL server through socket '/var/lib/mysql/mysql. Dannux Linux - Software 3 03-24-2006 09:44 AM
mysql error on boot up tommytomato Linux - Newbie 12 02-02-2004 03:33 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:54 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration