1

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

connect-string="nodeid=2;host=localhost:1186"

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 0.0.0.0:3306                0.0.0.0:*                   LISTEN      
tcp        0      0 xxx.xx.xxx.18:80            0.0.0.0:*                   LISTEN      
tcp        0      0 xxx.xx.xxx.172:80           0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:10000               0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:8081                0.0.0.0:*                   LISTEN      
tcp        0      0 0.0.0.0:22                  0.0.0.0:*                   LISTEN      
tcp        0      0 127.0.0.1:25                0.0.0.0:*                   LISTEN      
tcp        0      0 xxx.xx.xxx.18:443           0.0.0.0:*                   LISTEN      
tcp        0      0 xxx.xx.xxx.172:443          0.0.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/mysqld.pid --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/mysqld.pid --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?

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

4 Answers 4

3

I suppose

ps aux | fgrep mysql

doesn't show up useful details?

1
  • Added above. I don't see any useful info. Sep 20, 2011 at 2:51
2

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?

2
  • 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. Sep 19, 2011 at 23:11
  • 1
    @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, 2011 at 2:33
0

You can also use nmap to scan the open ports.

nmap -v localhost

or with additional options if needed.

0

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .