Bug #95597 mysql_config_editor can not deal password with "#"

Submitted: 2 Jun 2019 9:37 Modified: 7 Oct 2020 16:18
Reporter: li xichao Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S3 (Non-critical)
Version:5.6 5.7, 5.7.26 OS:Linux
Assigned to: CPU Architecture:Any

[2 Jun 2019 9:37] li xichao
Description:
In our mysql environment, when the password with "#"(such as 'Cp#123'), use mysql_config_editor config the login-path. the login-path can not login success.

How to repeat:
mysql_config_editor can not deal password with "#"

mysql  Ver 14.14 Distrib 5.6.41, for Linux (x86_64) using  EditLine wrapper

[root@localhost ~]# mysql -s -utest -p
Enter password:     --Input: Cp#123
mysql>              --login success
mysql> exit

[root@localhost ~]# mysql_config_editor set --login-path=test --user=test  --host=localhost -p
Enter password:     -- Cp#123
WARNING : 'test' path already exists and will be overwritten. 
 Continue? (Press y|Y for Yes, any other key for No) : Y
[root@localhost ~]# 

[root@localhost ~]# mysql --login-path=test
ERROR 1045 (28000): Access denied for user 'test'@'localhost' (using password: YES)   ---login failed
[root@localhost ~]#

[root@localhost ~]# my_print_defaults -s test
--user=test
--password=Cp         ----password is error
--host=localhost
[root@localhost ~]#
[2 Jun 2019 9:42] li xichao
none
[3 Jun 2019 12:19] MySQL Verification Team
Hello li xichao,

Thank you for the report and feedback.
Verified as described with 8.0.16 build.

regards,
Umesh
[17 Jul 2020 22:27] Stephen Buergler
The problem is that the .mylogin.cnf file interprets the # as the beginning of a comment.

A workaround is to quote your password when passing it to mysql_config_editor.
Type your password as:
"Cp#123"
instead of:
Cp#123

Note: if this issue ever gets fixed this workaround will break!
[7 Oct 2020 16:18] Paul DuBois
Posted by developer:
 
Fixed in 5.7.33, 8.0.23.

mysql_config_editor incorrectly treated # in password values as a
comment character.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.054 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.