Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am having quite a few problems on a tricky server.

One of my main problems at the moment is that tcpdump cannot seem to get the packets sent to mysql, unless I tinker with MySQL a bit.

This is what I run:

tcpdump -s 65535 -x -nn -q -tttt -i any -c 99999 port 3306

When I run this, no output is shown.

If however, I log into mysql using

mysql -h 127.0.0.1

..then tcpdump does show some output.

My problem is that the current traffic coming from apache does not show up using tcpdump and I do not know if I need to change a parameter in tcpdump, MySQL or apache.

Some more info:

netstat -tap | grep mysql

tcp        0      0 *:mysql   *:*                         LISTEN      2238/mysqld

cat /etc/hosts

127.0.0.1               localhost localhost.localdomain

Can anyone please help?

share|improve this question

1 Answer 1

up vote 5 down vote accepted

You're not seeing the traffic using tcpdump because MySQL isn't using TCP, it's using a Unix socket. You need to configure the database client (presumably a PHP application, although I guess in theory you could be using Apache itself to talk to MySQL) to connect to 127.0.0.1, because localhost (typically the default) is a special value that means "use a Unix socket" to the MySQL client library.

share|improve this answer
    
thanks, I appreciate the help –  Jonathan Apr 27 '12 at 9:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.