Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I don't have root and the sysadmin is gone for the day. Trying to find remote port for mySQL. So /etc/my.cnf does not have skip-networking enabled and says


but 1186 does not seem to be the port at least not for remote connections.

-sh-3.2$ netstat -apn | grep mysqld
(No info could be read for "-p": geteuid()=5290 but you should be root.)

I also tried

-sh-3.2$ netstat -anp | grep -i mysql
(No info could be read for "-p": geteuid()=5290 but you should be root.)
unix  2      [ ACC ]     STREAM     LISTENING     8720   -                   /var/lib/mysql/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     64766511 -                   /var/lib/mysql/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     64766258 -                   /var/lib/mysql/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     64765669 -                   /var/lib/mysql/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     64764151 -                   /var/lib/mysql/mysql.sock
unix  3      [ ]         STREAM     CONNECTED     64746846 -                   /var/lib/mysql/mysql.sock

Per Jim Garrison I tried

-sh-3.2$ netstat -nat|grep LISTEN
tcp        0      0      *                   LISTEN      
tcp        0      0  *                   LISTEN      
tcp        0      0 *                   LISTEN      
tcp        0      0     *                   LISTEN      
tcp        0      0      *                   LISTEN      
tcp        0      0        *                   LISTEN      
tcp        0      0      *                   LISTEN      
tcp        0      0 *                   LISTEN      
tcp        0      0*                   LISTEN

ps aux | fgrep mysql yields

root      3802  0.0  0.0  65972  1316 ?        S    Jun02   0:00 /bin/sh /usr/bin/mysqld_safe --datadir=/webroot/mysqldata --socket=/var/lib/mysql/mysql.sock --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/ --federated --user=mysql
mysql     3902  3.5  0.5 517284 97720 ?        Sl   Jun02 5619:08 /usr/libexec/mysqld --basedir=/usr --datadir=/webroot/mysqldata --user=mysql --federated --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/ --socket=/var/lib/mysql/mysql.sock
myusr     24025  0.0  0.0   6024   528 pts/1    S+   21:42   0:00 fgrep mysql

Anything else I can try?

share|improve this question

migrated from Sep 21 '11 at 1:39

This question came from our site for professional and enthusiast programmers.

Try netstat -nat|grep LISTEN – Ex Umbris Sep 19 '11 at 22:42
@Jim - tried only got tcp results. Added to post above – jerrygarciuh Sep 19 '11 at 22:53
You haven't actually said what happens when you DO try to connect. – Ex Umbris Sep 19 '11 at 23:39
Also, this is off topic for SO. Voting to move to serverfault. – Ex Umbris Sep 19 '11 at 23:40
@Jim No error. Just fails to connect. – jerrygarciuh Sep 20 '11 at 2:48

I suppose

ps aux | fgrep mysql

doesn't show up useful details?

share|improve this answer
Added above. I don't see any useful info. – jerrygarciuh Sep 20 '11 at 2:51

According to this MySQL documentation, the default port is 3306. You do have it shown there - might it be the port you're looking for?

share|improve this answer
I should have said - this odyssey started when I couldn't connect remotely on 3306. I know my IP is whitelisted and I can connect because of that to phpMyAdmin but I am trying to get the ODBC connector set up. – jerrygarciuh Sep 19 '11 at 23:11
@jerrygarciuh : phpMyAdmin running on the same server as the database? If so, access to that means nothing. Try telneting to port 3306 from the database machine and the remote system, and I'm guessing you'll find there's a host-based firewall blocking you. If you really need this and the sysadmin's still not around, you can always set up an SSH tunnel. – Joe H. Sep 21 '11 at 2:33

You can also use nmap to scan the open ports.

nmap -v localhost

or with additional options if needed.

share|improve this answer
up vote 0 down vote accepted

Joe H's was correct there was a firewall blocking me. Sorry for having so many folks try to help for naught.

share|improve this answer

Your Answer


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.