visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Databases :: MySql :: Quick Q: How can I know the port number of mySQL?


By: Squibi U.S.A.  Date: 02/03/2003 00:00:00  English  Points: 25 Status: Answered
Quality : Excellent
I know the default is 3306, just want to know if there is any command I can use to show the port number.

thanks.
By: VGR Date: 02/03/2003 06:55:00 English  Type : Answer
netstat

TCP athlon800:3306 athlon800:2142 ESTABLISHED
TCP athlon800:3306 athlon800:2175 ESTABLISHED
TCP athlon800:3306 athlon800:2207 ESTABLISHED
TCP athlon800:3306 athlon800:2219 ESTABLISHED
TCP athlon800:3306 athlon800:2227 ESTABLISHED
TCP athlon800:3306 athlon800:2261 ESTABLISHED
TCP athlon800:3306 athlon800:2266 ESTABLISHED
By: VGR Date: 02/03/2003 06:56:00 English  Type : Comment
an d this one (first one) of course :
TCP athlon800:1028 athlon800:3306 CLOSE_WAIT

on Win32 of course, but it's even easier on *nix
By: TheFalklands Date: 06/03/2003 04:16:00 English  Type : Comment
The only place I have seen the port number even really talked about is in the global option file (my.cnf) located in your base windows directory by default.

[client]
port=3306
socket=/tmp/mysql.sock

[mysqld]
port=3306
socket=/tmp/mysql.sock
set-variable = key_buffer_size=16M
set-variable = max_allowed_packet=1M

[mysqldump]
quick

There is no command that I have ever seen to return the value of the port set for MySQL.... Probably a security issue....

Hope this helps..
By: Squibi Date: 06/03/2003 14:55:00 English  Type : Comment
I could not find where my.cnf is, anyway, Thanks for the reply.
By: VGR Date: 06/03/2003 18:42:00 English  Type : Comment
you have either a my.cnf or a my.ini file
By: TheFalklands Date: 07/03/2003 23:48:00 English  Type : Comment
If you are using windows the configuration file is in the base windows directory:

Windows NT/2000
c:\WINNT\my.cnf

Windows XP
c:\WINDOWS\my.cnf

*nix
/etc/my.cnf

It could be my.ini but all of mine are my.cnf

Good Luck
By: Squibi Date: 08/03/2003 00:45:00 English  Type : Comment
I still cound not see any my.cnf or my.ini in /etc, I installed mySQL on Sun solaris, but just in my own directory, there are many other students' directories, I am not sure if that 's the reason that I don't have my.cnf in /etc because /etc is a directory for the whole Dept. not only for myself. BTW, what is /etc used for?

Is there any Unix command which can find a paticular file like Window's search? guess there should be one... or can "ps" command help? Not sure how to use the options.

Thank you!

By: VGR Date: 08/03/2003 01:28:00 English  Type : Comment
find / -name "my.ini"
find / -name "my.cnf"
By: TheFalklands Date: 11/03/2003 04:19:00 English  Type : Comment
Actually I just realized that if you type STATUS at the mysql command line it will show you the port number you are using....

like this:

mysql> STATUS
--------------
mysql Ver 11.18 Distrib 3.23.55, for Win95/Win98 (i32)

Connection id: 481
Current database:
Current user: ODBC@localhost
Server version: 3.23.55-max-debug
Protocol version: 10
Connection: localhost via TCP/IP
Client characterset: latin1
Server characterset: latin1
TCP port: 3306
Uptime: 3 days 17 hours 43 min 32 sec

Threads: 1 Questions: 30523 Slow queries: 0 Opens: 194 Flush tables: 1 Open
tables: 16 Queries per second avg: 0.094 Memory in use: 8433K Max memory used
: 9050K
--------------
By: VGR Date: 11/03/2003 05:39:00 English  Type : Comment
yes, but this supposes you can connect to MySql ;-)
Whereas the user tries to know which port is used 8-)
from command line ;-)
By: TheFalklands Date: 12/03/2003 06:04:00 English  Type : Comment
????? sorry I could not be of more help.

I would not think that there would be a command to show the port that mysql was using....

Maybe a security thing..??
By: VGR Date: 12/03/2003 06:58:00 English  Type : Comment
no
netstat shows it, firewalls too
from the localhost of course
By: TheFalklands Date: 12/03/2003 19:07:00 English  Type : Comment
It only show a port is being used.... how do you know if it is the port for MySQL?

Do register to be able to answer

EContact
browser fav
page generated in 325.221060 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page