Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added --enable-cleartext-plugin option to mysqldef #166

Merged
merged 2 commits into from
Oct 13, 2021

Conversation

Code-Hex
Copy link
Contributor

@Code-Hex Code-Hex commented Oct 13, 2021

What

I added --enable-cleartext-plugin option to mysqldef

Why

  • We use Cloud SQL as MySQL
  • We need to log in to a database with IAM database authentication
    • This method is required --enable-cleartext-plugin mysql option.

see: https://cloud.google.com/sql/docs/mysql/iam-logins#logging-in-as-a-user

$ mysqldef -u codehex -p $(gcloud auth print-access-token) -h 127.0.0.1 -P 13306 --dry-run database < schema.sql
2021/10/14 00:22:00 Error on DumpDDLs: this user requires clear text authentication. If you still want to use it, please add 'allowCleartextPasswords=1' to your DSN

$ mysqldef -u codehex -p $(gcloud auth print-access-token) -h 127.0.0.1 -P 13306 --enable-cleartext-plugin --dry-run database < schema.sql
-- dry run --

Comment on lines +18 to +19
// Only MySQL
MySQLEnableCleartextPlugin bool
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I thought the way was weird.
I'm wondering if the struct used to build DSN should be created for each driver. But I think that's too much for this PR, so I simply addressed it 🙇

Copy link
Collaborator

@k0kubun k0kubun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thank you!

@k0kubun k0kubun merged commit 6c21c59 into sqldef:master Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants