MySQL: Connection timed out

Username (e.g. epiz_XXX) or Website URL

username: epiz_27699881

Error Message

Failed to connect to MySQL: Connection timed out

Other Information

Can’t connect to db via php
i think is offline

$db_host = “”;
$db_user = “epiz_27699881”;


Make sure your code is correct

Also, I would suggest you to use PDO instead. Your code is very vulnerable to SQL injection attacks. Even if your website only has a few visitors, it’s always cosidered as the best practice to take security measures

Here’s some code for you in PDO:

$servername = '<YOUR_SERVER_NAME>'; // In this case:
$dbname = '<YOUR_DATABASE_NAME>'; // Make sure your database is correct 
$username = '<YOUR_USERNAME>'; // In this case: (epiz_27699881)
$password = '<YOUR_PASSWORD>'; // MAKE SURE YOUR PASSWORD IS CORRECT!!! If you are using a $ in your password, you'll need to escape it (\$)
try {
    $dbh = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
    $sql = "SELECT * FROM someplace WHERE somefield=".$_SESSION['id'];
    $users = $dbh->query($sql);
    echo '<table class="table">
    foreach ($users as $row) {
        echo "<tr><td>".$row['id']."</td><td>".$row['name']."</td></tr>";
    $dbh = null;
catch (PDOexception $e) {
    echo "Error is: " . $e-> etmessage();

Code is correct but the server is offline

Can you please provide a URL on your site where you have this issue so I can check it?

1 Like

nevermind, i fix my problem
thread to close