Wikimedia\Rdbms\DBConnectionError: Cannot access the database: No such file or directory (localhost)
This means:
MediaWiki Needs the Database: MediaWiki relies heavily on a database (usually MySQL or MariaDB) to store almost everything: page content, user information, settings, logs, etc.
Connection Failed: When you tried to access a wiki page, MediaWiki attempted to connect to its database server.
The Reason: The connection failed specifically because it couldn't find a necessary file or directory related to the database connection on the server named "localhost".
"No such file or directory (localhost)": This specific error message almost always indicates that MediaWiki (specifically, the PHP process running it) is trying to connect to the MySQL/MariaDB server using a Unix socket file (a special type of file used for local inter-process communication), but it cannot find that socket file at the expected location.
Why would the socket file be missing or inaccessible?
Here are the most common reasons:
Database Server Isn't Running: The most likely cause. If the MySQL or MariaDB service is stopped or has crashed, it won't create the socket file (usually named mysql.sock or mariadb.sock).
Incorrect Socket Path Configuration:
The database server might be configured to create the socket file in one location (e.g., /var/run/mysqld/mysqld.sock).
PHP might be configured (in php.ini) to look for the socket file in a different default location (e.g., /tmp/mysql.sock). If these don't match, the connection fails.
MediaWiki's LocalSettings.php might potentially override settings, but usually relies on PHP's default unless explicitly configured otherwise.
Permissions Issue: The web server process (e.g., www-data, apache, nginx) might not have the necessary permissions to access the directory containing the socket file or the socket file itself.
Disk Full: If the partition where the socket file is supposed to be created (often /var/run or /tmp) is full, the database server might fail to start or create the socket.
Recent Upgrade/Configuration Change: An update to the OS, PHP, or MySQL/MariaDB might have changed default paths or configurations.
How to Troubleshoot and Fix:
You'll need access to the server where your MediaWiki instance (rekowiki.org) is hosted.
Check Database Service Status:
Log in to your server via SSH.
Check if the database service is running. The command depends on your system:
systemctl status mysql or systemctl status mariadb (for systemd systems like Ubuntu 16.04+, Debian 8+, CentOS 7+)
service mysql status or service mariadb status (for older init systems)
If it's not running:
Try starting it: sudo systemctl start mysql or sudo systemctl start mariadb (or sudo service mysql start).
Check the database error logs for reasons why it might have failed to start. Common locations: /var/log/mysql/error.log, /var/log/mysqld.log, or check using journalctl -u mysql or journalctl -u mariadb.
If it is running: Proceed to the next steps.
Verify Socket Location:
Find where the database server is creating the socket:
Check the database configuration file (e.g., /etc/mysql/my.cnf, /etc/my.cnf, /etc/mysql/mariadb.conf.d/50-server.cnf). Look for the socket= line under the [mysqld] section.
Alternatively, connect to the database using the command line: mysql -u root -p (use your database root user or another admin user) and run the command: SHOW VARIABLES LIKE 'socket';
Find where PHP is looking for the socket:
Create a temporary PHP file (e.g., info.php) in your web root (/var/www/rekowiki.org/w/) with the content: <?php phpinfo(); ?>
Access this file in your browser (e.g., http://rekowiki.org/info.php).
Search the output page for pdo_mysql.default_socket and mysqli.default_socket. Note the path(s).
Delete the info.php file afterwards for security!
Compare: Do the paths match? If not, you need to align them. You can either:
Update your php.ini file(s) (check the path shown in phpinfo() output under "Loaded Configuration File") to set pdo_mysql.default_socket and mysqli.default_socket to the correct path found in the database config. Restart your web server (Apache/Nginx) and PHP-FPM service (if you use it) afterwards.
Or less commonly, change the socket path in the database configuration file and restart the database server.
Try Connecting via TCP/IP (Workaround/Test):
Edit your MediaWiki configuration file: /var/www/rekowiki.org/w/LocalSettings.php.
Find the line $wgDBserver = "localhost";.
Change it to use the IP address: $wgDBserver = "127.0.0.1";
Save the file and try accessing your wiki again.
If this works, it confirms the issue is specifically with the socket connection. While this is a valid workaround, it's usually slightly less performant than a socket connection, and it's good practice to fix the underlying socket issue if possible.
Check Permissions:
Identify the user your web server runs as (e.g., www-data, apache, nginx). You can often find this using ps aux | grep -E '[a]pache|[h]ttpd|[n]ginx|[_]www|[w]ww-data|[n]ginx'
Find the directory containing the actual socket file (from step 2).
Use ls -ld /path/to/socket/directory and ls -l /path/to/socket/directory/mysql.sock to check permissions. The web server user needs execute (x) permission on the directory and read/write (rw) permissions on the socket file itself.
Check Disk Space:
Run df -h on the server. Ensure partitions like /, /var, and /tmp are not full.
Start with step 1, as the database server not running is the most frequent cause of this specific error.