[MDEV-18861] mysqladmin ping -u root -pmypassword returns successfully, even if the login fails Created: 2019-03-08  Updated: 2019-03-10  Resolved: 2019-03-10

Status: Closed
Project: MariaDB Server
Component/s: Documentation, Scripts & Clients
Affects Version/s: 10.4.3
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Michael Hinkel Assignee: Ian Gilfillan
Resolution: Fixed Votes: 0
Labels: None
Environment:

official MariaDB docker image mariadb:10.4.3



 Description   

I wanted to use mysqladmin ping to perform a livenesscheck. I'm using the root user with an assigned password, thus the command:

mysqladmin -r root -pmypassword ping
echo $?

If login fails, the command writes an error message to the error stream - but the return value of the failed function is "0" although it should be "1" ($? retrieves the return value of the last executed command).
If you do this check with status instead of ping, the return value is "1", if login fails.



 Comments   
Comment by Elena Stepanova [ 2019-03-09 ]

Since the purpose of the pinging is to check whether the server is alive, doesn't it actually help your cause that it returns 0 when it's alive, no matter whether you can actually connect with these credentials or not?

Comment by Michael Hinkel [ 2019-03-09 ]

hmmm... this sounds like a reasonable argument. I didn't see it that way, but you're right: the server is alive and that's what a ping should check - not whether or not a user can successfully log in...
This bug report can be closed (I will see if I can find the right button).

Thanks!
Michael

Comment by Elena Stepanova [ 2019-03-09 ]

greenman,

It's intentional legacy behavior (and documented explicitly in MySQL manual). I think it's worth mentioning in the KB.

Comment by Ian Gilfillan [ 2019-03-10 ]

https://mariadb.com/kb/en/library/mysqladmin/ updated

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