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 - mysql client not asking password when using "-p" option
Summary: mysql client not asking password when using "-p" option
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: mysql
Version: 8.7
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: rc
: ---
Assignee: Michal Schorm
QA Contact: Jakub Heger
URL:
Whiteboard: Fixed by upstream in 8.0.31
Depends On:
Blocks: 2177735
TreeView+ depends on / blocked
 
Reported: 2023-01-18 18:38 UTC by Shreyas Mahangade
Modified: 2023-05-22 12:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 2177735 (view as bug list)
Environment:
Last Closed: 2023-05-22 12:28:00 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-145709 0 None None None 2023-01-19 07:45:21 UTC

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)


Note You need to log in before you can comment on or make changes to this bug.