Bug #55796 mysql cli-tool ignores port on localhost
| Submitted: | 6 Aug 2010 8:43 | Modified: | 6 Aug 2010 17:34 |
|---|---|---|---|
| Reporter: | Boa Thor | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Command-line Clients | Severity: | S3 (Non-critical) |
| Version: | 5.1.49 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | CLI MYSQL Port Localhost | ||
[6 Aug 2010 8:43]
Boa Thor
[6 Aug 2010 8:52]
Boa Thor
Especially in combination with PHP your localhost connection will ALLWAYs be made to the wrong instance / the one listening to 3306.
[6 Aug 2010 8:57]
Valeriy Kravchuk
I think our manual, http://dev.mysql.com/doc/refman/5.1/en/connecting.html, clearly explains this: "On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to connect to the local server by using a Unix socket file. This occurs even if a --port or -P option is given to specify a port number. To ensure that the client makes a TCP/IP connection to the local server, use --host or -h to specify a host name value of 127.0.0.1, or the IP address or name of the local server. You can also specify the connection protocol explicitly, even for localhost, by using the --protocol=TCP option."
[6 Aug 2010 17:34]
Boa Thor
Silently ignoring any user input is a bad habbit and no tool should ever do this.
[23 Jan 2015 15:21]
David Bennett
This is misleading at the very least: mysql -P #### Should do one of: a) Throw a warning stating TCP port is ignored in socket mode b) Fail with an stating TCP port is ignored in socket mode c) Assume TCP/IP mode It's simply too easy to connect to the wrong service without knowing it.
[17 Jan 2018 13:49]
Martin Häcker
So, are you going to change this?
[21 Jan 2019 2:49]
John Lin
Is there any update on this bug? Why is it labeled as "Not a Bug"?
[25 Apr 2019 16:59]
Jonathan Williams
Ignoring a command line parameter without warning is a bug. The fact that it's clearly documented makes it a clearly documented bug. Supplying a --port= or -P command line parameter when connecting to localhost on 'nix systems should fail. If that's not acceptable, it should at least generate a warning: $ mysql -P 3307 -p mysql: [Warning] --port command line argument ignored when connecting via sockets. Enter password: I agree with others that have commented here. This should be classified as a bug.
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.056 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.