Opened 7 weeks ago
Closed 4 weeks ago
#64014 closed enhancement (fixed)
Optionally expose non-ephemeral MySQL port
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 6.9 | Priority: | normal |
| Severity: | normal | Version: | 5.4 |
| Component: | Build/Test Tools | Keywords: | has-patch commit |
| Focuses: | Cc: |
Description (last modified by )
I've finally sat down to try to get PhpStorm to connect to the MySQL database in the wordpress-develop Docker environment. To do so, I needed to supply the port number for the mysql container. As noted in #48281, this can be done via:
docker-compose port mysql 3306
But it is annoying to have to re-run this to update the port in the PhpStorm database properties each time I start the wordpress-develop environment. Therefore, as with the LOCAL_PORT environment variable in .env for the web server, I suggest there be a LOCAL_DB_PORTS environment variable supported which allows a persistent port mapping to be established for the database:
-
docker-compose.yml
a b services: 70 70 - wpdevnet 71 71 72 72 ports: 73 - " 3306"73 - "${LOCAL_DB_PORTS-3306}" 74 74 75 75 environment: 76 76 MYSQL_ROOT_PASSWORD: password
With this change in place, I can update my .env to contain:
LOCAL_DB_PORTS="33060:3306"
And then my wordpress-develop mysql container is always accessible from the same 33060 port.
Change History (7)
This ticket was mentioned in PR #9968 on WordPress/wordpress-develop by @westonruter.
7 weeks ago
#2
- Keywords has-patch added
Trac ticket: https://core.trac.wordpress.org/ticket/64014
Given an
.envupdated to append:I'm able to configure PhpStorm as follows:
And I'm then able to access the database: