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.

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}' /var/log/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.

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

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