Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2162091

Summary: mysql client not asking password when using "-p" option
Product: Red Hat Enterprise Linux 8 Reporter: Shreyas Mahangade <smahanga>
Component: mysqlAssignee: Michal Schorm <mschorm>
Status: CLOSED CURRENTRELEASE QA Contact: Jakub Heger <jheger>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 8.7CC: databases-maint, ljavorsk
Target Milestone: rcKeywords: Rebase, Triaged, ZStream
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: Fixed by upstream in 8.0.31
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2177735 (view as bug list) Environment:
Last Closed: 2023-05-22 12:28:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 2177735    

Description Shreyas Mahangade 2023-01-18 18:38:29 UTC
Description of problem:

mysql client is not enforcing enter password when using -p option.

Version-Release number of selected component (if applicable):

MySQL 8.0.29+

How reproducible:

Always

Steps to Reproduce:
1. Create a user in mysql

~~~
mysql> CREATE USER 'test'@'localhost' IDENTIFIED BY 'test';
~~~

2. Create a ~/.my.ini file for autologin

~~~
[root@rhel8localhost ~]# cat > ~/.my.cnf
[client]
user=test
password=test
~~~

3. Try to login with "-p". Mysql will not prompt for password even for different -u <users>

~~~
[root@rhel8localhost ~]# mysql -h localhost -u test -p 
[...]
mysql> quit
#Now changing user to root
[root@rhel8localhost ~]# mysql -h localhost -u root -p 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
~~~

4. Remove ~/.my.ini and now it asks for password:

~~~
[root@rhel8localhost ~]# echo "" > ~/.my.cnf 
[root@rhel8localhost ~]# cat ~/.my.cnf 
[root@rhel8localhost ~]# mysql -h localhost -u test -p
Enter password: 
[root@rhel8localhost ~]# mysql -h localhost -u root -p 
Enter password:
~~~

Actual results:

mysql client did not asked for password upon using -p

Expected results:
mysql should enforce entering password when using -p option

Additional info:

As per upstream I can see this issue is fixed here in 8.0.31 (Bug #107205, Bug #34134984):

https://downloads.mysql.com/docs/mysql-8.0-relnotes-en.pdf

• Following a bug fix in MySQL 8.0.29, if the password was provided in an option file, the mysql client did
not prompt for a password if the -p option was specified at login. The client now always prompts for a
password when the -p option is specified and uses the specified password, even if an alternative was
populated from an option file. (Bug #107205, Bug #34134984)