migrate
migrate copied to clipboard
MySQL driver can't handle non-alphanumeric passwords
Problem
When using non-alphanumeric credentials, migrate fails to connect. database/mysql/mysql.go#L93 calls migrate.FilterCustomQuery(purl).String()
which in turn calls url.UserInfo.String()
. url.UserInfo.String()
ends up escaping the password resulting in an access denied error.
Input
The password in question is password&[
.
I run the migrate tool using.
migrate -path migrations -database 'mysql://test:password&[@tcp(localhost:3306)/test' up
Output
error: Error 1045: Access denied for user 'test'@'localhost' (using password: YES)
Meet the same bug here and do the fix https://github.com/mattes/migrate/pull/324