Back to commands

Hosting Operations

Read-only

Check Whether MySQL Responds

An app cannot connect to MySQL and you need to distinguish a dead server from a credential or query issue.

Command

mysqladmin ping -h 127.0.0.1 -P 3306

Before you run this

System impact: Read-only. Low when scoped to the shown target.

When not to use it: Do not treat ping success as proof that app credentials or schema permissions are correct.

Expected output

A short response such as mysqld is alive.

System impact

Read-only. Nothing changes. mysqladmin reports whether the server responds.

Recovery / rollback: no state is changed.

When to use it

Use during deploys, restarts, and first-response database checks.

When not to use it

Do not treat ping success as proof that app credentials or schema permissions are correct.

Watch this command run

Command transcript

This sanitized transcript shows the commands and output shape without exposing host details.

demo@lab:~$

$ mysqladmin ping -h localhost -P 3306

mysqld is alive

$ mysqladmin status

Uptime: 86400  Threads: 7  Questions: 23890  Slow queries: 3  Opens: 112  Open tables: 64  Queries per second avg: 0.276

$ ss -ltnp | grep ':3306'

LISTEN 0      151    0.0.0.0:3306       0.0.0.0:* users:(("mysqld",pid=733,fd=22))
View commands shown

These are the commands shown in the sanitized transcript.

Commands shown

  1. mysqladmin ping -h 127.0.0.1 -P 3306
  2. mysqladmin status
  3. ss -ltnp | grep ':3306'

next steps

Related commands

Hosting Operations Sensitive output

Show Active MySQL Sessions

The app was waiting behind busy sessions.

mysql -e "show full processlist;"
Hosting Operations Read-only

Check PostgreSQL Lock Waits

The outage was a queue, not a crash.

psql -X -c "select pid, wait_event_type, wait_event, state, left(query, 80) as query from pg_stat_activity where wait_event_type is not null order by pid;"
Hosting Operations Read-only

Group Server Errors by URL Path

A 500 spike is easier to triage when the broken path is obvious.

awk '$9 ~ /^5/ {count[$7]++} END {for (path in count) print count[path], path}' ./fixtures/nginx/access.log | sort -nr | head
Study mapping

Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.

  • lpic1:109-networking
  • lfcs:networking
  • lfcs:operations-deployment
  • lfcs:services-logs
  • linuxplus:provisional
  • linuxplus:troubleshooting
  • risk:read-only

Useful for

  • LPIC-1 style command-line practice
  • LFCS style performance tasks
  • Linux+ style troubleshooting review

Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.