DB connection via URI does not work when password contains &]~^ symbols
RicardoRamirezR opened this issue · 6 comments
Good day,
Given this password #X!12j999%&]vK~^SQX
The DB URI that looks like: mysql://user:%23X!12j999%&]vK~^SQX@127.0.0.1/example
I encoded # as %23
The connector seems to take the password up to the first & and DB gives:
[DBUI]
Error connecting to db example: DB exec error:
mysql: [ERROR] unknown variable '&]vK~^SQX@127.0.0.1:5000/example=1'
I've tried to encode:
- % -> %25
- & -> %26
- ] -> %5D
- ~ -> %7E
- ^ -> %5E
With no luck
Try with :DB mysql://user:%23X!12j999%&]vK~^SQX@127.0.0.1/example SELECT 1
. Does that work? If so, it's a Dadbod UI issue, not a Dadbod issue.
Try with
:DB mysql://user:%23X!12j999%&]vK~^SQX@127.0.0.1/example SELECT 1
. Does that work? If so, it's a Dadbod UI issue, not a Dadbod issue.
Thank you @tpope, same error message:
and the with:
:echo db#url#parse('mysql://user:%23X121999861VK-SQX0127.0.0.1/example')
I got:
{'host': '127.0.0.1', 'user': 'user', 'params': {}, 'password': '#X!12j999%&]vK~^SQX', 'scheme': 'mysql', 'path': '/example'}
:echo db#adapter#mysql#interactive('mysql://user:%23X!12j999%&]vK~^SQX@127.0.0.1/example')
['mysql', '-h', '127.0.0.1', '-u', 'user', '-p#X!12j999%&]vK~^SQX', 'example']
I don't have a MySQL install handy. What happens when you run the corresponding shell command?
mysql -h 127.0.0.1 -u user "-p#X!12j999%&]vK~^SQX" example
BUT when I encode %& with %25%26 as: mysql://user:%23X!12j999%25%26]vK~^SQX@127.0.0.1/example
it works. I thought I had done all the substitutions before, I just rechecked and made the correction. Thank you for your time.
I don't fully understand what went wrong here, but you should indeed encode those, so I guess we have our solution.