Skip to content

Mysql Troubleshooting

Daniel Neto edited this page Aug 18, 2026 · 2 revisions

MySQL/MariaDB troubleshooting

Start with the exact error, service status and logs. Installing a public database administration interface such as phpMyAdmin is not a diagnostic requirement and increases the attack surface.

Basic checks

sudo systemctl status mariadb
sudo journalctl -u mariadb --since '15 minutes ago'
mysql --version

The service may be named mysql, run in Docker, or be hosted elsewhere. Test from the same server/container and with the same host, port, database and username used by AVideo. Do not expose the password on the command line or in a screenshot.

AVideo's database values are stored in videos/configuration.php; never publish this file. A successful administrator/root login does not prove AVideo's limited database user has access.

Error 2002: no such file or directory / connection refused

Common causes are a stopped database, wrong host/port, using a local socket when TCP is required, missing PHP MySQL extension, container hostname confusion or firewall rules. localhost may select a Unix socket; 127.0.0.1 selects TCP, and neither points to another Docker container.

Verify the intended connection method before changing permissions or reinstalling packages.

Error 1040: too many connections

This means the server's connection limit was reached. Increasing max_connections without finding the cause can consume more memory and postpone another outage.

  1. Check current/max connections and the process list.
  2. Identify slow queries, abandoned workers, traffic spikes or plugins opening excessive connections.
  3. Check database CPU, memory and disk latency.
  4. Correct the cause and size connection limits together with available memory.
  5. Change the correct active MariaDB/MySQL configuration file, validate it and restart during a maintenance window if required.

Do not copy an arbitrary value such as 500; each connection has memory cost and the safe value depends on workload and configuration.

Access denied

Confirm the exact database username, authentication host (for example localhost versus another service), password, database name and grants. Use a dedicated AVideo user with privileges only on its database. Reset the credential deliberately and update AVideo immediately; do not grant global/root access as a shortcut.

Database server has gone away / packet errors

Check the first error and operation size, database uptime/restarts, network interruptions, max_allowed_packet, timeouts, disk/full conditions and slow transfers. See Error while sending QUERY packet.

When asking for help, include the database product/version, deployment layout, exact numeric error code, timestamp and sanitized log lines. Remove queries containing personal data and all credentials.

Clone this wiki locally