-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Connect to wp-env DB host from external tooling #24772
Comments
Should add the way I have gotten a connection working so far is to open WSL terminal and run Using |
It sounds like we need to expose the mysql port for wp-env so that it is accessible like this 🤔 Interestingly, we do set a port for the mysql service, not sure if that works:
I'm not sure what format this is in, but you have total access to wp-cli tools which might be able to help! You can run wp-cli commands with For example, there is a wp-cli import command documented here: https://developer.wordpress.org/cli/commands/import/. You'd run that like |
I too have been able to connect to the Docker DB instance, using the port identified when looking at the results of |
It is definitely random, changes each time I boot the env. |
@danieliser yes, so the port is random due to how Docker works, and the PR that exposed an external port talks about this explicitly and there was discussion about making it configurable but it was left being random for the time being. #21545 (comment) |
It's not a solution for this issue, but accessing the
can easily done using Since the Some examples (directly from my Linux terminal) :
Hope this helps a bit until this issue gets resolved. |
Related is #29776 which discusses adding a WordPress import option. |
Closing this, as I think this is documented now (https://github.com/WordPress/gutenberg/blob/trunk/docs/contributors/code/getting-started-with-code-contribution.md#accessing-the-mysql-database). We're also working towards a custom startup script which would allow imports (#49996) |
This may already exist and I'm not finding it which means we should work on updating the docs, but if that is not the case then this may be a feature request for the @wordpress/env package.
Specifically looking to use MySQL Workbench or Navicat MySQL tools to work on custom db tables in a plugin would be my particular use case.
I have 2 parts I'm stuck on:
I need to be able to connect externally. I managed to get this working once by luck, but after the env was ips, ports all seem to have changed. I can't find a reliable way to map a connection.
We have a large sample set of data needed for our testing currently, not sure if wp-env was really meant for that or not but trying to make it work.
I can of course rerun my internal tool to generate mock data but this can take hours depending on the time ranges being generated.
Preferably I'd love a way to run extra mysql imports from a custom file on creation of an environment for a specific project.
Might be nice to add a custom_sql_import option of sorts to the
.wp-env.json
fileThanks.
The text was updated successfully, but these errors were encountered: