|
| 1 | +# oblakstudio/mysql50 |
| 2 | + |
| 3 | +[](https://hub.docker.com/r/oblakstudio/mysql50) |
| 4 | +[](https://hub.docker.com/r/oblakstudio/mysql50/tags) |
| 5 | +[](https://hub.docker.com/r/oblakstudio/mysql50) |
| 6 | +[](https://hub.docker.com/r/oblakstudio/mysql50/tags) |
| 7 | +[](https://github.com/oblakstudio/mysql50-docker/actions/workflows/release.yml) |
| 8 | + |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +--- |
| 13 | + |
| 14 | +Legacy **MySQL 5.0** packaged for modern container workflows. The image uses |
| 15 | +Debian Etch's archived `5.0.32-7etch12` packages and follows the Docker Official |
| 16 | +Image's first-run environment contract where MySQL 5.0 supports it. |
| 17 | + |
| 18 | +> [!WARNING] |
| 19 | +> MySQL 5.0 and Debian Etch are end-of-life software with known, unpatched |
| 20 | +> security issues. This image exists for trusted legacy workloads. Never expose |
| 21 | +> it directly to the public internet or another untrusted network. |
| 22 | +
|
| 23 | +## Tags |
| 24 | + |
| 25 | +The wrapped MySQL version is fixed; image releases are versioned independently |
| 26 | +with semantic-release. |
| 27 | + |
| 28 | +| Tag | Description | |
| 29 | +| --- | --- | |
| 30 | +| `latest` | Newest image release | |
| 31 | +| `5.0.32` | Fixed wrapped MySQL version | |
| 32 | +| `X.Y.Z` | Exact image release, such as `1.0.0` | |
| 33 | +| `X.Y`, `X` | Moving semantic image-release aliases | |
| 34 | + |
| 35 | +All tags contain MySQL 5.0.32 on Debian Etch. |
| 36 | + |
| 37 | +## Architectures |
| 38 | + |
| 39 | +The image index publishes these Etch-supported platforms: |
| 40 | + |
| 41 | +- `linux/amd64` |
| 42 | +- `linux/386` |
| 43 | +- `linux/arm/v5` |
| 44 | + |
| 45 | +There is no native `linux/arm64` image. An ARM64 host must explicitly request |
| 46 | +and emulate the 32-bit ARM image when its Docker/QEMU setup supports it: |
| 47 | + |
| 48 | +```bash |
| 49 | +docker run --rm --platform=linux/arm/v5 \ |
| 50 | + -e MYSQL_ROOT_PASSWORD=secret \ |
| 51 | + oblakstudio/mysql50 |
| 52 | +``` |
| 53 | + |
| 54 | +## Quick start |
| 55 | + |
| 56 | +```bash |
| 57 | +docker run --rm -d --name mysql50 \ |
| 58 | + -e MYSQL_ROOT_PASSWORD=secret \ |
| 59 | + -p 3306:3306 \ |
| 60 | + oblakstudio/mysql50 |
| 61 | +``` |
| 62 | + |
| 63 | +Connect from a client with MySQL's native password protocol: |
| 64 | + |
| 65 | +```bash |
| 66 | +mysql -h127.0.0.1 -P3306 -uroot -psecret |
| 67 | +``` |
| 68 | + |
| 69 | +## Environment variables |
| 70 | + |
| 71 | +First-run initialization accepts the familiar official-image variables: |
| 72 | + |
| 73 | +| Variable | Description | |
| 74 | +| --- | --- | |
| 75 | +| `MYSQL_ROOT_PASSWORD` | Password for `root` | |
| 76 | +| `MYSQL_ALLOW_EMPTY_PASSWORD` | Allow an empty root password when non-empty; insecure | |
| 77 | +| `MYSQL_RANDOM_ROOT_PASSWORD` | Generate a root password and print it once | |
| 78 | +| `MYSQL_ROOT_HOST` | Additional root host; defaults to `%` | |
| 79 | +| `MYSQL_DATABASE` | Database to create | |
| 80 | +| `MYSQL_USER` / `MYSQL_PASSWORD` | Non-root user to create; both are required | |
| 81 | +| `MYSQL_INITDB_SKIP_TZINFO` | Skip loading timezone tables when non-empty | |
| 82 | + |
| 83 | +One of `MYSQL_ROOT_PASSWORD`, `MYSQL_ALLOW_EMPTY_PASSWORD`, or |
| 84 | +`MYSQL_RANDOM_ROOT_PASSWORD` is required for an empty datadir. |
| 85 | + |
| 86 | +`MYSQL_ROOT_PASSWORD`, `MYSQL_ROOT_HOST`, `MYSQL_DATABASE`, `MYSQL_USER`, and |
| 87 | +`MYSQL_PASSWORD` also accept mutually exclusive `*_FILE` forms for Docker |
| 88 | +secrets: |
| 89 | + |
| 90 | +```bash |
| 91 | +docker run -d --name mysql50 \ |
| 92 | + -e MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql-root \ |
| 93 | + -v ./mysql-root-password:/run/secrets/mysql-root:ro \ |
| 94 | + oblakstudio/mysql50 |
| 95 | +``` |
| 96 | + |
| 97 | +`MYSQL_ROOT_HOST` defaults to `%`, matching the current Docker Official Image, |
| 98 | +so root can connect across a Docker network. Protect the container at the |
| 99 | +network boundary or set `MYSQL_ROOT_HOST=localhost` when remote root access is |
| 100 | +not needed. |
| 101 | + |
| 102 | +MySQL 5.0 cannot expire an account password using the newer official-image |
| 103 | +mechanism. Setting `MYSQL_ONETIME_PASSWORD` therefore produces an explicit |
| 104 | +error rather than being silently ignored. |
| 105 | + |
| 106 | +## Initialization files |
| 107 | + |
| 108 | +Files in `/docker-entrypoint-initdb.d/` run in glob order only when the datadir |
| 109 | +is empty: |
| 110 | + |
| 111 | +- `*.sh` files are sourced. |
| 112 | +- `*.sql` files are executed by the MySQL client. |
| 113 | +- `*.sql.gz` files are decompressed and executed. |
| 114 | + |
| 115 | +When `MYSQL_DATABASE` is set, SQL files run with that database selected. |
| 116 | + |
| 117 | +```bash |
| 118 | +docker run -d --name mysql50 \ |
| 119 | + -e MYSQL_ROOT_PASSWORD=secret \ |
| 120 | + -e MYSQL_DATABASE=legacy_app \ |
| 121 | + -v ./seed.sql:/docker-entrypoint-initdb.d/seed.sql:ro \ |
| 122 | + oblakstudio/mysql50 |
| 123 | +``` |
| 124 | + |
| 125 | +## Data persistence |
| 126 | + |
| 127 | +The image declares `/var/lib/mysql` as a volume. Mount a named volume to retain |
| 128 | +data across containers: |
| 129 | + |
| 130 | +```bash |
| 131 | +docker run -d --name mysql50 \ |
| 132 | + -e MYSQL_ROOT_PASSWORD=secret \ |
| 133 | + -v mysql50-data:/var/lib/mysql \ |
| 134 | + oblakstudio/mysql50 |
| 135 | +``` |
| 136 | + |
| 137 | +If `/var/lib/mysql/mysql` already exists, initialization variables and init |
| 138 | +files are ignored. Existing databases, accounts, and passwords are not changed. |
| 139 | + |
| 140 | +## Password hashing |
| 141 | + |
| 142 | +`my.cnf` defaults to `old_passwords = 0`, so accounts created during |
| 143 | +initialization use MySQL 5.0's native 41-byte hashes. This is more compatible |
| 144 | +with later clients than the pre-4.1 16-byte format. |
| 145 | + |
| 146 | +Applications that require old hashes can mount a replacement `/etc/mysql/my.cnf` |
| 147 | +before initializing a new datadir. Changing the option does not rewrite hashes |
| 148 | +already stored in an existing datadir. |
| 149 | + |
| 150 | +## Configuration and server options |
| 151 | + |
| 152 | +The bundled `my.cnf` sets the socket, PID file, datadir, port, password-hash |
| 153 | +mode, and `bind-address = 0.0.0.0`. Mount a complete replacement at |
| 154 | +`/etc/mysql/my.cnf` to override it. |
| 155 | + |
| 156 | +Arguments beginning with `-` are passed to `mysqld`: |
| 157 | + |
| 158 | +```bash |
| 159 | +docker run -d -e MYSQL_ROOT_PASSWORD=secret \ |
| 160 | + oblakstudio/mysql50 --max-connections=200 |
| 161 | +``` |
| 162 | + |
| 163 | +## Building and testing |
| 164 | + |
| 165 | +```bash |
| 166 | +make build # Build linux/amd64 by default |
| 167 | +make build-all # Build all release platforms into the Buildx cache |
| 168 | +make structure # Verify package, config, and image cleanup |
| 169 | +make smoke # Verify initialization, TCP auth, init files, and persistence |
| 170 | +make smoke-all # Build and smoke all platforms under native/QEMU execution |
| 171 | +make run # Run the selected image locally |
| 172 | +make shell # Open Bash in the selected image |
| 173 | +``` |
| 174 | + |
| 175 | +Override `PLATFORM`, `IMAGE`, `VERSION`, `ROOT_PASSWORD`, or `PORT` as needed. |
| 176 | +Multi-platform targets require a Buildx builder with the corresponding QEMU |
| 177 | +handlers. |
| 178 | + |
| 179 | +## Releases |
| 180 | + |
| 181 | +Pushes to `master` run semantic-release using Conventional Commits. A published |
| 182 | +GitHub release triggers Buildx, which publishes one manifest containing amd64, |
| 183 | +386, and arm/v5 images. Image release tags (`1.0.0`, `1.0`, `1`) evolve while |
| 184 | +the fixed upstream tag remains `5.0.32`. |
| 185 | + |
| 186 | +## How it works |
| 187 | + |
| 188 | +MySQL 5.0 is no longer available from current distribution repositories. The |
| 189 | +Dockerfile starts from `debian/eol:etch-slim` and installs the archived, |
| 190 | +architecture-specific `mysql-server-5.0` and `mysql-client-5.0` packages pinned |
| 191 | +to Debian revision `5.0.32-7etch12`. |
| 192 | + |
| 193 | +The package-created datadir is deleted in the installation layer. On first |
| 194 | +container start, `docker-entrypoint.sh` creates system tables, configures |
| 195 | +accounts through a socket-only temporary server, processes init files, shuts |
| 196 | +the temporary server down, and finally starts the networked server as `mysql`. |
| 197 | + |
| 198 | +## Credits and license |
| 199 | + |
| 200 | +Built and maintained by [Oblak Studio](https://oblak.studio). MySQL is a |
| 201 | +trademark of Oracle Corporation. This repository packages already released |
| 202 | +legacy software and is not affiliated with or endorsed by Oracle. |
| 203 | + |
| 204 | +The Dockerfile, entrypoint, tests, and workflow files are released under the |
| 205 | +[MIT License](LICENSE). |
0 commit comments