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
doneIn 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
mysql Command Reference: Flags, Usage & CI ExamplesReference for the mysql client: -h, -u, -p, -P, -e, MYSQL_PWD, forcing TCP, and a CI example that loads a sch…
mysqldump Command Reference: Flags, Usage & CI ExamplesReference for mysqldump: --single-transaction, --databases, --no-data, --routines, and a CI example that expo…
pg_isready Command Reference: Flags, Exit Codes & CI ExamplesReference for pg_isready: -h, -p, -t, -q, the 0/1/2/3 exit codes, and a CI wait loop that blocks until a Post…