[MDEV-14706] MySQL command line tool can ignore "--port" argument without giving warning Created: 2017-12-19  Updated: 2017-12-28  Resolved: 2017-12-28

Status: Closed
Project: MariaDB Server
Component/s: Documentation
Affects Version/s: 10.0, 10.2.9
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Don Lindsay Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: None
Environment:

Fedora 21 and Fedora 27, both x86_64



 Description   

I have a box running MariaDB at the usual port, 3306.
It also has a MariaDB running inside a container. The container exports to port 3310.
Assuming $IP is the IP address of the host, then when I say (on the box):
mysql -h $IP --port=3310

then I get connected to the containerized MariaDB, as expected. But if I leave off the host specifier and just say:

mysql --port=3310

then I get connected to the non-containerized MariaDB at the default port, 3306. There is no warning or error message that this is happening, even if I specify "-v -v -v". This is a bug. It should either not do that, or else it should issue a warning, or else the documentation should specify this behavior.



 Comments   
Comment by Daniel Black [ 2017-12-19 ]

I suspect its using a UNIX socket. Can you please show \s output after connecting. --protocol=TCP would be required to connect to a port.

Comment by Don Lindsay [ 2017-12-19 ]

You are correct. When talking to the container, "\s" reports:
Connection: <my ipnumber> via TCP/IP
TCP port: 3310

But if I leave off the "h <myipnumber>", and continue to specify "-port 3310", "\s" reports:
Connection: Localhost via UNIX socket
UNIX socket: /var/lib/mysql/mysql.sock

Thanks for the comment: I didn't know about "\s". We now have a clue about how the behavior arises.

Comment by Ian Gilfillan [ 2017-12-28 ]

Which protocol is used was already reasonably well-documented in https://mariadb.com/kb/en/library/mysql-command-line-client/#how-to-specify-which-protocol-to-use-when-connecting-to-the-mysqld-server but I've added a specific mention of port being ignored as an example.

Comment by Don Lindsay [ 2017-12-28 ]

That's not an acceptable fix. "The facts are somewhere on the internet" only helps the person who is googling after being bitten by a bug. It does not help the person who is trying to construct a correct command. Please improve the man page, or the "--help". Or, even better, get the command to issue a warning saying that it plans to ignore what the user has explicitly asked for.

Generated at Thu Feb 08 08:15:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.