public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] Trouble with mysql
@ 2005-08-31 20:52 Michael Sullivan
  2005-08-31 21:20 ` Eric Crossman
  2005-08-31 21:37 ` Tim Igoe
  0 siblings, 2 replies; 8+ messages in thread
From: Michael Sullivan @ 2005-08-31 20:52 UTC (permalink / raw
  To: gentoo-user

I am having trouble with /etc/init.d/mysql.  I rebooted my system, and
when it finished rebooting I tried to connect to the mysql daemon and
failed.  I looked in /var/log/mysql:  There was a file there called
mysql.err.  The contents were:

050831 15:47:29  mysqld started
050831 15:47:30 Can't start server: Bind on TCP/IP port: Address already
in use
050831 15:47:30 Do you already have another mysqld server running on
port: 3306 ?
050831 15:47:30 Aborting

050831 15:47:30 /usr/sbin/mysqld: Shutdown Complete

050831 15:47:30  mysqld ended


I tried netstat | grep '3306':

bullet mysql # netstat | grep '3306'
bullet mysql #

The output was blank, so I assume that port 3306 is NOT in use.  Any
ideas?

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 20:52 [gentoo-user] Trouble with mysql Michael Sullivan
@ 2005-08-31 21:20 ` Eric Crossman
  2005-08-31 21:29   ` Michael Sullivan
  2005-08-31 21:37 ` Tim Igoe
  1 sibling, 1 reply; 8+ messages in thread
From: Eric Crossman @ 2005-08-31 21:20 UTC (permalink / raw
  To: gentoo-user

On Wed, 2005-08-31 at 15:52 -0500, Michael Sullivan wrote:
> I am having trouble with /etc/init.d/mysql.  I rebooted my system, and
> when it finished rebooting I tried to connect to the mysql daemon and
> failed.  I looked in /var/log/mysql:  There was a file there called
> mysql.err.  The contents were:
> 
> 050831 15:47:29  mysqld started
> 050831 15:47:30 Can't start server: Bind on TCP/IP port: Address already
> in use
> 050831 15:47:30 Do you already have another mysqld server running on
> port: 3306 ?
> 050831 15:47:30 Aborting
> 
> 050831 15:47:30 /usr/sbin/mysqld: Shutdown Complete
> 
> 050831 15:47:30  mysqld ended
> 
> 
> I tried netstat | grep '3306':
> 
> bullet mysql # netstat | grep '3306'
> bullet mysql #
> 
> The output was blank, so I assume that port 3306 is NOT in use.  Any
> ideas?
> 

Try netstat -an | grep 3306. The "-n" option forces netstat to show port
numbers and not translate them to familiar names. The "-p" option is
also useful to determine what program has opened the port.

Eric


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 21:20 ` Eric Crossman
@ 2005-08-31 21:29   ` Michael Sullivan
  0 siblings, 0 replies; 8+ messages in thread
From: Michael Sullivan @ 2005-08-31 21:29 UTC (permalink / raw
  To: gentoo-user

On Wed, 2005-08-31 at 17:20 -0400, Eric Crossman wrote:
> On Wed, 2005-08-31 at 15:52 -0500, Michael Sullivan wrote:
> > I am having trouble with /etc/init.d/mysql.  I rebooted my system, and
> > when it finished rebooting I tried to connect to the mysql daemon and
> > failed.  I looked in /var/log/mysql:  There was a file there called
> > mysql.err.  The contents were:
> > 
> > 050831 15:47:29  mysqld started
> > 050831 15:47:30 Can't start server: Bind on TCP/IP port: Address already
> > in use
> > 050831 15:47:30 Do you already have another mysqld server running on
> > port: 3306 ?
> > 050831 15:47:30 Aborting
> > 
> > 050831 15:47:30 /usr/sbin/mysqld: Shutdown Complete
> > 
> > 050831 15:47:30  mysqld ended
> > 
> > 
> > I tried netstat | grep '3306':
> > 
> > bullet mysql # netstat | grep '3306'
> > bullet mysql #
> > 
> > The output was blank, so I assume that port 3306 is NOT in use.  Any
> > ideas?
> > 
> 
> Try netstat -an | grep 3306. The "-n" option forces netstat to show port
> numbers and not translate them to familiar names. The "-p" option is
> also useful to determine what program has opened the port.
> 
> Eric

I ran netstat with -an grepping for port 3306.  It found it:

bullet ~ # netstat -an | grep 3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*
LISTEN


so I grepp'd netstat for mysql:

bullet ~ # netstat | grep 'mysql'
unix  3      [ ]         STREAM     CONNECTING
0      /var/run/mysqld/mysqld.sock

It was running, so I tried using the mysql client:

bullet ~ # mysql -u root -p
Enter password:
ERROR 2002: Can't connect to local MySQL server through socket
'/var/run/mysqld/mysqld.sock' (2)
bullet ~ #

I don't understand this...


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 20:52 [gentoo-user] Trouble with mysql Michael Sullivan
  2005-08-31 21:20 ` Eric Crossman
@ 2005-08-31 21:37 ` Tim Igoe
  2005-08-31 21:52   ` Michael Sullivan
  1 sibling, 1 reply; 8+ messages in thread
From: Tim Igoe @ 2005-08-31 21:37 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1288 bytes --]



Michael Sullivan wrote:
> I am having trouble with /etc/init.d/mysql.  I rebooted my system, and
> when it finished rebooting I tried to connect to the mysql daemon and
> failed.  I looked in /var/log/mysql:  There was a file there called
> mysql.err.  The contents were:
> 
> 050831 15:47:29  mysqld started
> 050831 15:47:30 Can't start server: Bind on TCP/IP port: Address already
> in use
> 050831 15:47:30 Do you already have another mysqld server running on
> port: 3306 ?
> 050831 15:47:30 Aborting
> 
> 050831 15:47:30 /usr/sbin/mysqld: Shutdown Complete
> 
> 050831 15:47:30  mysqld ended
> 



check the output of ps aux
look for mysqld processes in the list - if it is running then try
killing the mysqld processes or restarting the machine

> 
> I tried netstat | grep '3306':
> 
> bullet mysql # netstat | grep '3306'
> bullet mysql #

netstat -n | grep 3306

or

netstat | grep mysql

might be better

> 
> The output was blank, so I assume that port 3306 is NOT in use.  Any
> ideas?
> 

Do you have something else that could be using the port - a rootkit or
someone else running a service on the box?

-- 
Tim Igoe
tim@igoe.me.uk
http://tim.igoe.me.uk - Personal Site
http://tv.igoe.me.uk - UK TV Guide

"Computers are like Air-con, open windows and they stop working!"

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 21:37 ` Tim Igoe
@ 2005-08-31 21:52   ` Michael Sullivan
  2005-08-31 23:04     ` Paul Maszy
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Sullivan @ 2005-08-31 21:52 UTC (permalink / raw
  To: gentoo-user

On Wed, 2005-08-31 at 22:37 +0100, Tim Igoe wrote:
> 
> Michael Sullivan wrote:
> > I am having trouble with /etc/init.d/mysql.  I rebooted my system, and
> > when it finished rebooting I tried to connect to the mysql daemon and
> > failed.  I looked in /var/log/mysql:  There was a file there called
> > mysql.err.  The contents were:
> > 
> > 050831 15:47:29  mysqld started
> > 050831 15:47:30 Can't start server: Bind on TCP/IP port: Address already
> > in use
> > 050831 15:47:30 Do you already have another mysqld server running on
> > port: 3306 ?
> > 050831 15:47:30 Aborting
> > 
> > 050831 15:47:30 /usr/sbin/mysqld: Shutdown Complete
> > 
> > 050831 15:47:30  mysqld ended
> > 
> 
> 
> 
> check the output of ps aux
> look for mysqld processes in the list - if it is running then try
> killing the mysqld processes or restarting the machine
> 
> > 
> > I tried netstat | grep '3306':
> > 
> > bullet mysql # netstat | grep '3306'
> > bullet mysql #
> 
> netstat -n | grep 3306
> 
> or
> 
> netstat | grep mysql
> 
> might be better
> 
> > 
> > The output was blank, so I assume that port 3306 is NOT in use.  Any
> > ideas?
> > 
> 
> Do you have something else that could be using the port - a rootkit or
> someone else running a service on the box?


I did ps aux | grep 'mysqld' and got a listing of several mysqld
processes.  I killed each one using kill -9 and then rebooted the
machine.  Once it was fully rebooted I issued another ps aux | grep
'mysqld'.  Here is the output:

bullet ~ # ps aux | grep 'mysqld'
root      8115  0.0  1.5   2216   948 ?        Ss   11:50
0:00 /bin/sh /usr/bin/mysqld_safe --defaults-file=/etc/mysql/my.cnf
mysql     8151  0.2  3.9  38728  2416 ?        S    11:50
0:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr
--datadir=/var/lib/mysql --user=mysql
--pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306
--socket=/var/run/mysqld/mysqld.sock
mysql     8153  0.0  3.9  38728  2420 ?        S    11:50
0:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr
--datadir=/var/lib/mysql --user=mysql
--pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306
--socket=/var/run/mysqld/mysqld.sock
mysql     8154  0.0  3.9  38728  2420 ?        S    11:50
0:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr
--datadir=/var/lib/mysql --user=mysql
--pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306
--socket=/var/run/mysqld/mysqld.sock
mysql     8155  0.0  3.9  38728  2420 ?        S    11:50
0:00 /usr/sbin/mysqld --defaults-file=/etc/mysql/my.cnf --basedir=/usr
--datadir=/var/lib/mysql --user=mysql
--pid-file=/var/run/mysqld/mysqld.pid --skip-locking --port=3306
--socket=/var/run/mysqld/mysqld.sock
root      8848  0.0  0.8   1448   492 pts/0    S+   11:51   0:00 grep
mysqld
bullet ~ #

I have no idea why so many of them are being started.  How do I stop my
system from starting more than one mysql daemon?

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 21:52   ` Michael Sullivan
@ 2005-08-31 23:04     ` Paul Maszy
  2005-09-01  0:39       ` Michael Sullivan
  0 siblings, 1 reply; 8+ messages in thread
From: Paul Maszy @ 2005-08-31 23:04 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/html, Size: 4659 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-08-31 23:04     ` Paul Maszy
@ 2005-09-01  0:39       ` Michael Sullivan
  2005-09-01 10:03         ` Bastian Balthazar Bux
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Sullivan @ 2005-09-01  0:39 UTC (permalink / raw
  To: gentoo-user

On Wed, 2005-08-31 at 18:04 -0500, Paul Maszy wrote:
> 
>     You shouldnt have restarted. 
> 
>     mysql is already starting on boot up. It showing that many mysql
> daemons is normal and ok. 
> 
>     # /etc/init.d/mysql stop
> --- You will probably get an error here, if everything happened as you
> said. If not, your done. 
>   
>     kill -9 `ps -ef | grep mysql | awk '{ print $2 }'`
>     
>     As for connecting to mysql, try without a password
>     # mysql -u root 
> 
> 
>     See if it connects. 
> 
> 
> 
>     Until you determine what is starting it, dont reboot. It just puts
> you back to square 1. I think the question you are asking is why is
> mysql already running. Its gotta be starting in the init scripts
> somehow, and if its not in /etc/init.d/mysql I would check for other
> scripts starting it. 
> 
>     # grep mysql /etc/init.d/*

I ran /etc/init.d/mysql stop and it stopped without error - all of them.
I ran /etc/init.d/mysql start and it started again - now there are a
whole lot of them in the ps listing, but I can connect with the mysql
client.  It seems to be fixed for now..


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [gentoo-user] Trouble with mysql
  2005-09-01  0:39       ` Michael Sullivan
@ 2005-09-01 10:03         ` Bastian Balthazar Bux
  0 siblings, 0 replies; 8+ messages in thread
From: Bastian Balthazar Bux @ 2005-09-01 10:03 UTC (permalink / raw
  To: gentoo-user

Michael Sullivan wrote:
> On Wed, 2005-08-31 at 18:04 -0500, Paul Maszy wrote:
> 
>>    You shouldnt have restarted. 
>>
>>    mysql is already starting on boot up. It showing that many mysql
>>daemons is normal and ok. 
>>
[snip]
> 
> 
> I ran /etc/init.d/mysql stop and it stopped without error - all of them.
> I ran /etc/init.d/mysql start and it started again - now there are a
> whole lot of them in the ps listing, but I can connect with the mysql
> client.  It seems to be fixed for now..
> 
> 
Just in case doubts are still there look at the output of "ps fax" that
show a tree of processes:

breakall # ps fax | grep mysql
30560 pts/0    S+     0:00          \_ grep mysql
 7504 ?        Ss     0:00 /bin/sh /usr/bin/mysqld_safe [...]
 7542 ?        S      0:00  \_ /usr/sbin/mysqld --defaul[...]ck
 7543 ?        S      0:00      \_ /usr/sbin/mysqld --de[...]d.sock
 7544 ?        S      0:00          \_ /usr/sbin/mysqld [...]ysqld.sock
 7545 ?        S      0:00          \_ /usr/sbin/mysqld [...]ysqld.sock
[.....................................................................]
 7565 ?        S      0:00          \_ /usr/sbin/mysqld [...]ysqld.sock
 7583 ?        S      0:02          \_ /usr/sbin/mysqld [...]ysqld.sock

there is "mysqld_safe" that is a shell script, it's only a wrapper
around "mysqld" the real daemon.
mysql is a threaded application, and ps show all it's threads.

Just a hint, try to *avoid* "kill -9" and use a simply "kill" or "pkill"
if it's possible.

ah maybe that on other system you can't see all the threads with "ps",
that's nothing to worry about, probably that box is using "nptl" .

Ciao
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-09-01 10:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-31 20:52 [gentoo-user] Trouble with mysql Michael Sullivan
2005-08-31 21:20 ` Eric Crossman
2005-08-31 21:29   ` Michael Sullivan
2005-08-31 21:37 ` Tim Igoe
2005-08-31 21:52   ` Michael Sullivan
2005-08-31 23:04     ` Paul Maszy
2005-09-01  0:39       ` Michael Sullivan
2005-09-01 10:03         ` Bastian Balthazar Bux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox