# mysqladmin: Usage, Options & Common CI Errors

> mysqladmin administers a MySQL/MariaDB server from the shell. Reference for ping, status, create, --wait, and the readiness-check use in CI service containers.

Source: https://latchkey.dev/learn/command-reference/mysqladmin-command  
Updated: 2026-06-25

mysqladmin runs administrative commands like ping, status, and create on MySQL.

mysqladmin ping is the canonical "wait for MySQL" probe in CI. The whole pattern depends on knowing that ping reports success even when access is denied, which is usually what you want for readiness.

## What it does

mysqladmin performs administrative operations on a MySQL/MariaDB server: checking liveness (ping), showing status and variables, creating/dropping databases, and flushing. In pipelines its main job is the readiness probe before migrations run.

## Common usage

```Terminal
mysqladmin -h 127.0.0.1 -u root -psecret ping
until mysqladmin -h 127.0.0.1 -u root -psecret ping --silent; do sleep 1; done
mysqladmin -h 127.0.0.1 -u root -psecret status
mysqladmin -h db -u root -psecret create app_test
```

## Options

| Command / flag | What it does |
| --- | --- |
| ping | Check whether the server is alive |
| status | Show uptime, threads, queries |
| create / drop <db> | Create / drop a database |
| --wait[=N] | Retry the connection N times |
| --silent | Suppress output (rely on exit code) |
| flush-hosts / flush-logs | Flush host cache / logs |

## Common errors in CI

mysqladmin: connect to server at '127.0.0.1' failed: Can't connect ... (111) means the server is still starting - loop on ping until it succeeds. Note ping prints "mysqld is alive" and exits 0 even on "Access denied" because the server answered, which is fine for a readiness gate but means ping does not validate credentials. Use -h 127.0.0.1 (not localhost) to force TCP to the service container rather than a missing local socket.

## Using this in CI

A runner shell is not a login shell. It does not read your dotfiles, it usually has no TTY, and by default it does not stop on the first error, so a failing command in the middle of a multi-line `run` block can leave the job green.

```.github/workflows/ci.yml
# make the shell behave the way you assume it does
- name: Build
  shell: bash
  run: |
    set -euo pipefail    # exit on error, undefined vars, and pipeline failures
    ./do-the-thing | tee out.log
```

> Without `pipefail`, a pipeline exits with the status of the LAST command, so `failing-cmd | tee log` reports success. Piping to `tee` for logging is the single most common way a broken build reports green.

## FAQ

### mysqladmin: Usage, Options & Common CI Errors?

mysqladmin ping is the canonical "wait for MySQL" probe in CI. The whole pattern depends on knowing that ping reports success even when access is denied, which is usually what you want for readiness.

### What it does?

mysqladmin performs administrative operations on a MySQL/MariaDB server: checking liveness (ping), showing status and variables, creating/dropping databases, and flushing. In pipelines its main job is the readiness probe before migrations run.

### Common errors in CI?

mysqladmin: connect to server at '127.0.0.1' failed: Can't connect ... (111) means the server is still starting - loop on ping until it succeeds. Note ping prints "mysqld is alive" and exits 0 even on "Access denied" because the server answered, which is fine for a readiness gate but means ping does not validate credentials.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
