LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-11-2005, 06:28 PM   #1
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Rep: Reputation: 0
MySQL Help...


Hello Everyone. Here is my story... My server went out on me 5 hours ago... and I'm still infront of my computer trying to see what's going on. I figure it's the MySQL. Everytime i enter this command..

Quote:
root@myBox root]# service mysqld start
or
root@myBox root]# service psa start
I recieved this...
Quote:
root@myBox root]# env: /etc/init.d/mysqld: No such file or directory.
or
root@myBox root]#ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
I talk with my server provider... Godaddy.... and their advice is to pay extra $50 so they could erase my files... and restart everything over again...cough...get another server. What kind of support is this?

Anywayz, I've try configuring the my.cnf file and the mysqld in /etc/init.d ... and it still doesn't work. Is there anywayz i can get Mysql to work again? and How?

I'm on Fedora Core 2... Mysql is 3.23 .... Plesk 7.5 reloader... Apache ...

Here's my current mysqld file.
Code:
#!/bin/bash
#
# mysqld	This shell script takes care of starting and stopping
#		the MySQL subsystem (mysqld).
#
# chkconfig: - 64 36
# 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=$?
	# If you've removed anonymous users, this line must be changed to
	# use a user that is allowed to ping mysqld.
	ping="/usr/bin/mysqladmin -uUNKNOWN_MYSQL_USER ping"
        # 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 "`$ping 2> /dev/null`" ]; then
                    break;
            else
                    sleep 1;
            fi
            done
            if !([ -n "`$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
    sleep 2
    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 $?
Here's my current my.cnf file.
Code:
[mysqld]
innodb_data_file_path=ibdata1:10M:autoextend
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
     
[mysql.server]
user=mysql
basedir=/var/lib

[safe_mysqld]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

Thx a lot.

Last edited by jtshaw; 05-12-2005 at 08:49 PM.
 
Old 05-11-2005, 08:22 PM   #2
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
What happens when you enter mysqld_safe & ?
 
Old 05-11-2005, 09:46 PM   #3
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
This is what i'm recieving...

Quote:
[1] 2977
-bash: mysqld_safe: command not found
 
Old 05-11-2005, 10:16 PM   #4
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
Sorry I should have posted this originally: I think this was abandoned in version 3 but also try safe_mysqld & (typed the other way around, the & just backgrounds the process). Normally, though, the two commands are symlinked for backwards compatibility, so it's odd that it wouldn't find it.

When you say your server went down you mean your webserver? You've had mysql running correctly before right?
 
Old 05-12-2005, 02:21 AM   #5
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
nah... the web server is fine. It's just the mysql server. I can't get it start. Without the mysql server running... all of the websites that I currently host are currently down.

Last edited by thachp; 05-12-2005 at 02:25 AM.
 
Old 05-12-2005, 02:45 AM   #6
Boby
Member
 
Registered: Feb 2004
Posts: 781

Rep: Reputation: Disabled
Quote:
-bash: mysqld_safe: command not found
/path/to/mysql/bin/mysqld_safe &
You have to start the command from the mysql folder, exactly from the "bin" folder in mysql folder.

Is the location of the "mysql.sock" correct? Try "locate mysql.sock"

Boby
 
Old 05-12-2005, 04:10 AM   #7
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
k .. I type in the command...
locate mysql.sock


And I got this...

/var/lib/mysql/mysql.sock

I'm not sure what you mean by....

/path/to/mysql/bin/mysqld_safe &
 
Old 05-12-2005, 12:09 PM   #8
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
He's answering why it says bash: command not found. It's because mysqld isn't in your $PATH so you have to type the literal path to the binary.

But that doesn't make any sense, looking at the startup file you posted, mysql is at least symlinked to "/usr/bin/safe_mysqld". Try
Code:
locate mysqld_safe
to find out where it is if it's not in fact in /usr/bin
 
Old 05-12-2005, 06:30 PM   #9
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Hmmm... Still not getting anything. Is this the same command as...
Code:
mysqld_safe?
if so... I'm getting

Code:
A mysqld process already exists.
Here is part of my current mysqld.log file.
Code:
Status information:

Current dir: /var/lib/mysql/
Current locks:
key_cache status:
blocks used:         0
not flushed:         0
w_requests:          0
writes:              0
r_requests:          0
reads:               0

handler status:
read_key:            0
read_next:           0
read_rnd             0
read_first:          0
write:               0
delete               0
update:              0

Table status:
Opened tables:          0
Open tables:            0
Open files:             0
Open streams:           0
/usr/libexec/mysqld: ready for connections
A mysqld process already exists at  Thu May 12 11:46:51 PDT 2005

Last edited by thachp; 05-12-2005 at 06:36 PM.
 
Old 05-12-2005, 08:28 PM   #10
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
What about when you try
Code:
mysqladmin status
You should get something like this
Code:
root@gateway:/var/lib# mysqladmin status
Uptime: 7348  Threads: 1  Questions: 102  Slow queries: 0  Opens: 8  Flush tables: 1  Open tables: 1  Queries per second avg: 0.014
I have a feeling tht your mysqld may have died but left a sock and lockfile which makes new mysqlds think it's still running. If the above command gets you output like this
Code:
root@gateway:/var/lib# mysqladmin status
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
...then delete the socket and lockfile and try restarting mysql again:
Code:
sudo rm /var/run/mysql/mysql.sock
sudo rm /var/lock/subsys/mysqld
sudo /usr/bin/mysqld_safe &
 
Old 05-12-2005, 08:39 PM   #11
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
On a side note: Please don't mark your threads as urgent, be considerate to the thousands of others that ask questions and then the members that come here in their own free time to help members. No members questions has a higher priority than the other, marking your threads as urgent does nothing to get answers faster.
 
Old 05-12-2005, 11:28 PM   #12
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
hmmm... I think I'm getting somewgere here.
Quote:
On a side note: Please don't mark your threads as urgent, be considerate to the thousands of others that ask questions and then the members that come here in their own free time to help members. No members questions has a higher priority than the other, marking your threads as urgent does nothing to get answers faster.
I apologize.

I type in "mysqladmin status"... and I got...

Quote:
mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysql/mysql.sock' exists!
But... I can't locate the sock file or the lock file. How can I do that? I manage to get a reply from Godaddy... and here's what it said.

Quote:
Our administrator has looked into the issue with your Dedicated server configuration. It appears that you have installed MySQL-server-4.0.21-0.i386

This version of mySQL is incompatible with the Plesk management system as it uses a different syntax than earlier versions. You might attempt to roll that install back to an earlier version of mySQL to repair your issue. If you wish for us to make the change for you, we will need to charge an Expert Hands fee.

Should you require further assistance on this or any other issue, don't hesitate to contact us any time of the day or night at (480) 505-8877. Or, if you prefer email, you can send your questions or comments to support@supportwebsite.com.
Hmmm... How do you roll back mysql?
 
Old 05-13-2005, 10:43 AM   #13
michaelsanford
Member
 
Registered: Feb 2005
Location: Ottawa/Montréal
Distribution: Slackware + Darwin (MacOS X)
Posts: 468

Rep: Reputation: 30
I don't know anything about the "Plesk management system".

I would not recommend rolling back MySQL below version 4 unless it becomes totally necessary.

You can't find the socket at "/var/run/mysql/mysql.sock" ?

I'm afraid if it has something to do with the interaction with this management system I can't be helpful any more as I know nothing about it.
 
Old 05-13-2005, 08:22 PM   #14
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Thank for all your help michaelsanford. Hmmm... I just notice that Plesk is compatiable with MYSQL version 4. It looks like my best option right now is to repartition the whole server... and start everything over again. I have to wonder myself... how did this happen? All I did is reboot. Darn it!!!
 
Old 05-13-2005, 10:03 PM   #15
thachp
LQ Newbie
 
Registered: Feb 2005
Posts: 20

Original Poster
Rep: Reputation: 0
Ha! Ha! Ha! Sorry guys.. I have to laugh at myself for this one. I was about to gave up... and reformat the server..... but before doing that... I decided to just type all mysql commands that was in my head. And guest.. what? It work now. Lolz. Mother fucking MySQL work now. Wierd.. thing is i don't remember which command get it to work... I mean I tried everything.

Anyhow, I guess.... luck!
 
  


Reply



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
boot sector and lilo collapse !!!!! URGENT URGENT URGEN !!!!! frelihm Linux - Software 21 12-02-2009 10:21 AM
I've got an error massage when i install MySql,urgent novmcgrady Linux - Software 1 05-12-2005 08:37 PM
mysql problem, urgent chadi Linux - General 2 12-08-2004 05:46 PM
mysql error, urgent please help chadi Linux - General 1 11-12-2004 06:56 AM
MySQL access problem. URGENT. Please help! correro Linux - General 3 03-15-2003 07:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:30 PM.

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
Open Source Consulting | Domain Registration