Mysql: Connect with password has "%" symbol

Created on 9 Aug 2019  ·  4Comments  ·  Source: go-sql-driver/mysql

How to connect with password has "%" symbol?

Most helpful comment

Use the connector interface or change the password.

All 4 comments

Use the connector interface or change the password.

What exactly is the problem with a password containing %?. There are some restrictions on the username, but there shouldn't be any on the password.

@methane do you have example?

I can't find any problem with a password containing %.

@victormongi Please fill the issue template https://github.com/go-sql-driver/mysql/blob/master/.github/ISSUE_TEMPLATE.md

here is my example.


Issue description

All tests pass even if a password containing "%" symbol.

Example code

docker run -d -p 127.0.0.1:3307:3306 --name mysqld -e MYSQL_DATABASE=gotest -e MYSQL_USER=gotest -e MYSQL_PASSWORD=sec%ret -e MYSQL_ROOT_PASSWORD=verysecret mysql:5.7 --innodb_log_file_size=256MB --innodb_buffer_pool_size=512MB --max_allowed_packet=16MB --local-infile=1
export MYSQL_TEST_USER=gotest
export MYSQL_TEST_PASS=sec%ret
export MYSQL_TEST_ADDR=127.0.0.1:3307
go test -v ./..

Error log

(omit)
=== RUN   TestIsolationLevelMapping
--- PASS: TestIsolationLevelMapping (0.00s)
PASS
ok      github.com/go-sql-driver/mysql  40.855s

Configuration

Driver version (or git SHA): 877a9775f06853f611fb2d4e817d92479242d1cd

Go version: go version go1.12.7 darwin/amd64

Server version: mysql Ver 14.14 Distrib 5.7.26, for Linux (x86_64) using EditLine wrapper

Server OS: Docker on macOS Mojave 10.14.6

Was this page helpful?
0 / 5 - 0 ratings