Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 13 months ago

#48281 closed enhancement (fixed)

Expose port 3306 of MySQL container

Reported by: ocean90 Owned by: SergeyBiryukov
Priority: normal Milestone: 5.4
Component: Build/Test Tools Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

Description

To allow accessing the container from external the port 3306 should get exposed. This is done by defining ports in the config, see ​https://docs.docker.com/compose/compose-file/#ports.

To retrieve the host port you can then use docker-compose port mysql 3306.

Attachments (2)

48281.diff​ (312 bytes ) - added by ocean90 7 years ago.
48281.2.diff​ (312 bytes ) - added by peterwilsoncc 7 years ago.

Download all attachments as: .zip

Change History (9)

#1 follow-up: @peterwilsoncc
7 years ago

48281.2.diff​ accounts for users that may be exposing a database on the default port:

  • sets default to a non-standard value, 8836
  • allows users to change the port using an environment variable, similar to the local port for the web server

#2 in reply to: ↑ 1 @ocean90
7 years ago

Replying to peterwilsoncc:

48281.2.diff​ accounts for users that may be exposing a database on the default port:

That’s why my patch only defines the container port to allow docker-compose to choose an ephemeral host port.

#3 @donmhico
7 years ago

+1 to this. I've tested 48281.2.diff and it works. Hopefully this gets committed soon.

This ticket was mentioned in ​Slack in #core by david.baumwald. ​View the logs.


7 years ago

#5 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution → fixed
  • Status new → closed

In 47225:

Build/Test Tools: Expose port 3306 of MySQL container.

This only defines the container port to allow docker-compose to choose an ephemeral host port.

Props ocean90, peterwilsoncc.
Fixes #48281.

#6 @westonruter
14 months ago

Follow-up: #64014 (Optionally expose non-ephemeral MySQL port)

#7 @westonruter
13 months ago

In 60926:

Build/Test Tools: Introduce LOCAL_DB_PORTS environment variable.

This change introduces a LOCAL_DB_PORTS environment variable to the wordpress-develop Docker environment. This allows users to establish a persistent port mapping for the MySQL database, making it easier to connect to with development tools like PhpStorm. Otherwise, the default database port is ephemeral.

For example, setting LOCAL_DB_PORTS="33060:3306" in the .env file will make the MySQL container consistently accessible on port 33060.

Developed in ​https://github.com/WordPress/wordpress-develop/pull/9968.

Props westonruter, mindctrl.
See #48281.
Fixes #64014.

Note: See TracTickets for help on using tickets.