Can't connect to MySQL server if password contains '#' character
See original GitHub issueterracotta.get_driver(mysql_path)
Fails when mysql_path contains ‘#’ in any part. It’s actually because of urllib.parse
, which fails to parse the URL components if any of the component has ‘#’ in it. There may be other special characters too causing the issue. The password part of the URL has high probability of having these characters. My example :
mysql_path = 'mysql://root:admin#!@123@localhost:3306/db'
Also if you move the ‘#’ around in the password itself, the parsing result is different and hence the errors too
I solved it by using quote/unquote
of urllib.parse
:
mysql_path = 'mysql://root:'+ quote('admin#!@123') + '@localhost:3306/db'
password=urlparse.unquote(con_params.password) if con_params.password else None,
Is this solution right way to handle the issue?
Issue Analytics
- State:
- Created 3 years ago
- Comments:12
Top Results From Across the Web
Mysql command line password with special characters is not ...
Logging into mysql using bash. For ubuntu or linux shell try to use command mysql -u username -p'p@ssw()rD'. for remote host login use...
Read more >4.14 Troubleshooting Problems Connecting to MySQL
The server should let you connect because the MySQL root user has no password initially. That is also a security risk, so setting...
Read more >Bug #1598992 “MySQL Server installation fails if root ...
The postinst script for mysql-server-5.7 can take a root password for the server as input. It does not properly escape this password before ......
Read more >mysql_connect - Manual - PHP
mysql_connect — Open a connection to a MySQL Server ... variables_order configure directive doesn't contain character E . On Windows, if the environment...
Read more >mysql connection from bash shell with special characters in ...
The correct syntax which should get executed is mysql --host=localhost --user=root --password='>fjkIyu#K7T?' Please see, if any changes i need ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Well I looked into the legal characters for username, it seems any ASCII character is allowed, so if there is a colon in the username, it’s ambiguous to differentiate. I tried out some DNS parsers, they all fail. They all assume user to handle the quote/unquote for special cases. But if we are not doing that, I think only choice left is to use env variables.
Config variables incoming in #188.