MySQL Outage: cPanel Down, Database Connection Failed - What Happened?

So I logged into my cPanel today and got a blank page. Then my site threw a database connection error. I can’t get into cPanel at all, and my site is down. Checked my code—I’m using PDO with proper error handling, but the error says it can’t connect to the MySQL server through the socket. Anyone else seeing this? Is this a server-wide issue?

Here’s the error I’m seeing:

Warning: PDO::__construct(): Can't connect to local MySQL server through socket '/var/tmp/[inactive website]' (2) in /home/artanis/public_html/config.php on line 24
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [2002] No such file or directory

I’ve checked my config and the socket path is correct. Must be a server problem.

Topic Summary: cPanel blank, site down with PDO MySQL socket error: “Can’t connect to local MySQL server through socket ‘/var/tmp/…’”. Suspects server-wide issue.

:open_book: Topic Overview (Wikipedia):

MySQL is a free and open-source relational database management system (RDBMS). Its name is a combination of “My”, the name of co-founder Michael Widenius’ daughter My, and “SQL”, the acronym for Structured Query Language. A relational database organizes data into one or more data tables in which data may be related to each other; these relations help structure the data. SQL is a language that programmers use to create, modify and extract data from the relational database, as well as control user access to the database. In addition to relational databases and SQL, an RDBMS like MySQL works with an operating system to implement a relational database in a computer’s storage system, manages users, allows for network access and facilitates testing database integrity and creation of backups. — Read more on Wikipedia

:movie_camera: Video Tutorial:

:books: Official Documentation & Reference Links:

---
title: MySQL Outage Sequence
---
flowchart TD
    A["MySQL Server Crash"] --> B["cPanel Services Lose DB Connection"]
    B --> C["Websites Down"]
    A --> D["Admin Checks Error Logs"]
    D --> E["Identify MySQL Process Crash"]
    E --> F["Restart MySQL Service"]
    F --> G["Services Restored"]

Hey Artanis, this happens from time to time. Some user probably abused the MySQL resources and the admins had to take the databases down to stabilize things. Just give it a few hours—it usually comes back. I checked my cPanel a few minutes ago and it was fine, so it might be intermittent.

Patience is key. The admins will fix it as soon as they can. In the meantime, double-check your code to make sure you’re using secure database connections. If you’re still using old mysql_* functions, switch to PDO or mysqli. Here’s a modern PDO example:

$dsn = 'mysql:host=localhost;dbname=your_db;charset=utf8mb4';
$options = [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
    PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
    PDO::ATTR_EMULATE_PREPARES => false,
];
try {
    $pdo = new PDO($dsn, $user, $pass, $options);
} catch (PDOException $e) {
    error_log($e->getMessage());
    die('Database connection failed.');
}

That way, if the server is down, your site handles it gracefully.

Alright, we identified the issue. A user was running heavy queries that maxed out MySQL resources. We’ve restarted the MySQL service and applied some limits to prevent recurrence. cPanel and databases should be back up now.

For future reference: please optimize your database queries and avoid resource-intensive operations. Use indexes, limit result sets, and consider caching. If you’re experiencing issues, check the server status on our forums rather than running repeated connection attempts.

Also, note that we provided a list of rules: excessive resource usage can lead to temporary suspensions. Let’s keep the server stable for everyone.

Now that everything is restored, test your sites. If you still see errors, clear your browser cache and try again. And please update any legacy code—the old mysql_* functions are removed in PHP 7+. Use PDO or mysqli as shown above.