Skip to content
Latchkey

mysqladmin Command Reference: Commands, Usage & CI Examples

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

mysqladmin performs administrative operations on a MySQL/MariaDB server: liveness checks, status, creating/dropping databases, and flushing. In CI its main job is the readiness probe.

Common flags and usage

  • ping: check whether the server is alive
  • status: show uptime, threads, and queries
  • create / drop <db>: create or drop a database
  • --wait[=N]: retry the connection N times
  • --silent: suppress output and rely on the exit code
  • -h 127.0.0.1: force TCP to a service container

Example

shell
until mysqladmin -h 127.0.0.1 -u root -p${MYSQL_PWD} ping --silent; do
  echo "waiting for mysql..."; sleep 1
done

In CI

mysqladmin ping is the canonical wait-for-MySQL gate. Note ping reports the server is alive and exits 0 even on "Access denied", because the server answered, which is fine for readiness but means it does not validate credentials.

Key takeaways

  • mysqladmin ping is the standard MySQL readiness probe in CI.
  • ping succeeds on "Access denied" because the server still answered.
  • Use -h 127.0.0.1 to force TCP to a service container.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →