Advanced · 20 min · practise every command in the built-in terminal

Mission: Error Establishing a Database Connection

Ticket #7410 — the café's online menu is down. Read it:

cat ~/ticket-7410.txt

Bring http://aroma.example/menu.php back — and make sure it survives the next reboot.

Useful commands:

curl -s http://aroma.example/menu.php
sudo tail -3 /var/log/nginx/error.log
systemctl status mariadb
sudo journalctl -u mariadb -n 5
cat /var/www/aroma/config.php

💡 "Error establishing a database connection" is what the app tells visitors. The real reason is in the logs: PHP's message lands in nginx's error.log.

Practice tasks

  1. See what visitors see
  2. Find the real error in nginx's log
  3. Start MariaDB — and make it start at every boot
  4. The menu is still down: find the new error
  5. Give the app the new password
  6. Reboot — and see the menu still there

Commands in this lesson

Missions