Skip to content

feat: add MySQL command support #5749

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

Closed
wants to merge 13 commits into from

Conversation

enbiyagoral
Copy link
Contributor

@enbiyagoral enbiyagoral commented May 20, 2025

This PR adds MySQL connection support to the Boundary CLI. Users can now securely and easily connect to MySQL targets using the boundary connect mysql command.

What’s Added?

  • boundary connect mysql command
  • Credential and target support for MySQL
  • Required tests and documentation updates

Related Issue

Closes #5740

Testing

  • All tests passed successfully
  • MySQL connection tests were performed

Images

image image

Note: This PR follows the same architecture and UX as the existing helper command for PostgreSQL.

@enbiyagoral enbiyagoral requested a review from a team as a code owner May 20, 2025 08:58
@github-actions github-actions bot added the core label May 20, 2025
Copy link

hashicorp-cla-app bot commented May 20, 2025

CLA assistant check
All committers have signed the CLA.

@enbiyagoral
Copy link
Contributor Author

@bgajjala8 @RyanDerr @johanbrandhorst

Hi! I've addressed all the review feedback:

  1. ✅ Now using --defaults-file instead of direct password in args
  2. --defaults-file is now the first argument
  3. ✅ Added -p flag when no password provided for prompt
  4. ✅ Followed the same pattern as PostgreSQL implementation

Ready for re-review! Thank you for the guidance.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

This is really cool, thank you! There are a few things we'll need to update before we can merge this:

  1. We will need to add some documentation to the website, so users can find this new command. Please add a new file called mysql.mdx to https://github.com/hashicorp/boundary/tree/main/website/content/docs/commands/connect where the other connect helpers are documented. You should be able to base it on the postgres one. Also update the index.mdx document with references to the new document.
  2. We will need to add some tests for this functionality. Fortunately, it's pretty easy to run mysql for testing purposes, just as we do with postgresql. I think we could add a StartMysql helper to https://github.com/hashicorp/boundary/blob/main/testing/internal/e2e/infra/docker.go, then create a test similar to https://github.com/hashicorp/boundary/blob/main/testing/internal/e2e/tests/base_plus/target_tcp_connect_postgres_test.go that will connect to the MySQL instance and run some commands.
  3. We'll need to update the CHANGELOG.md with this new feature :). Please follow the existing patterns.

Again, thanks for your contribution to Boundary, this is really exciting!

@enbiyagoral enbiyagoral requested a review from a team as a code owner June 28, 2025 16:45
   Fixes content check error by adding mysql.mdx to docs navigation.
   MySQL page now appears in Commands > connect section alongside postgres.
@enbiyagoral
Copy link
Contributor Author

@bgajjala8 @johanbrandhorst - Updated with all requested changes:

Security fixes:

  • Switched to --defaults-file approach ✅
  • Password prompting with -p flag ✅

Documentation & Testing:

  • Added MySQL documentation page ✅
  • Added comprehensive tests ✅
  • Added StartMysql helper ✅

Ready for re-review!

@enbiyagoral
Copy link
Contributor Author

Thanks for the feedback! I've updated the test to be completely self-contained - it now starts its own MySQL container using infra.StartMysql(), eliminates any dependency on environment variables, and actually tests the functionality by executing real MySQL commands (SHOW TABLES, SELECT DATABASE()) through the boundary connect mysql command while validating the connection works end-to-end with proper cleanup of all Docker resources.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

Thanks for your patience. I think the test may fail on some machines because the MySQL output is not accurate. Furthermore, the way our CI is set up at the moment makes it impossible for us to run all the tests against this PR, so I was wondering if I could have your consent for us to recreate this contribution in a PR created by a HashiCorp IBM employee so the CI will run? You will still have the commit credit of course.

@enbiyagoral
Copy link
Contributor Author

Thanks for your patience. I think the test may fail on some machines because the MySQL output is not accurate. Furthermore, the way our CI is set up at the moment makes it impossible for us to run all the tests against this PR, so I was wondering if I could have your consent for us to recreate this contribution in a PR created by a HashiCorp IBM employee so the CI will run? You will still have the commit credit of course.

I’m happy to give my consent. Please feel free to proceed, and I appreciate you keeping the commit credit. Let me know if I can assist further.

Copy link
Collaborator

@johanbrandhorst johanbrandhorst left a comment

Choose a reason for hiding this comment

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

This looks good to me now! As discussed, lets have @bgajjala8 recreate the PR so we can run CI on it. Thanks for your contribution! We can close this PR out once the other one has been merged.

@enbiyagoral
Copy link
Contributor Author

Sounds great — thanks for the review and the support @bgajjala8 @johanbrandhorst! Looking forward to the merged version.

@bgajjala8
Copy link
Contributor

@enbiyagoral This feature has been merged! 😄 Thanks for your contribution to Boundary, this was really exciting!

Closing this PR out now
CC: @johanbrandhorst @RyanDerr

@bgajjala8 bgajjala8 closed this Jul 8, 2025
@enbiyagoral
Copy link
Contributor Author

Thanks so much everyone for the help and reviews (@johanbrandhorst, @bgajjala8 )— this was my first contribution to Boundary, and it was a great experience! 🙌 Looking forward to future contributions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: Add MySQL connection support to Boundary CLI
4 participants