Unable to mysqli_connect()@mysql8 -- mysql8 STILL down?


#1

[Sorry to post in a new thread – the previous thread was closed and can’t post more]

Still unable to connect MySQL server on ‘mysql8.000webhost.com’. I got the old control panel.

Investigation: MySQL server (mysql8.000webhost.com) is NOT reachable from the web-server (mybudget.netne.net).

details of connecting/ping from webserver:

Failed to connect to MySQL: Can’t connect to MySQL server on ‘mysql8.000webhost.com’ (113)

Warning: fsockopen() [function.fsockopen]: unable to connect to mysql8.000webhost.com:3306 (Connection timed out) in /home//public_html/test.php


#2

Can you try the three methods down the middle of the tutorial to see if any work for connection?

Method 1 — Connecting to the database using PDO (recommended)

<?php
$servername = "localhost";
$username = "username";
$password = "password";
$database = "database";

try {
    $conn = new PDO("mysql:host=$servername;dbname=$database", $username, $password);
    // set the PDO error mode to exception
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully"; 
    } catch(PDOException $e) {    
    echo "Connection failed: " . $e->getMessage();
    }
?>

Method 2 — Connecting to the database using mysqli (Object-Oriented)

<?php

$servername = "localhost";
$username = "username";
$password = "password";
$database = "database";

// Create connection
$conn = new mysqli($servername, $username, $password, $database);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully";
?>

Method 3 — Connecting to the database using mysqli_connect (Procedural)

<?php

$servername = "localhost";
$username = "username";
$password = "password";
$database = "database";

// Create connection
$conn = mysqli_connect($servername, $username, $password, $database);

// Check connection
if (!$conn) {
    die("Connection failed: " . mysqli_connect_error());
}

echo "Connected successfully";
?>


#3

I use method 2 to connect. Unfortunately, it did not work.

Warnings/Error:
Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can’t connect to MySQL server on ‘mysql8.000webhost.com’ (113)

Connection failed: Can’t connect to MySQL server on ‘mysql8.000webhost.com’ (113)

I even can’t seem to ping the MySQL server from my local machine or the web-server [1-2].

[1] http://stackoverflow.com/questions/9841635/how-can-i-ping-a-server-port-with-php
[2] http://stackoverflow.com/questions/1239068/ping-site-and-return-result-in-php


#4

I know remote connections to MySQL are blocked in the free hosting so you can’t remotely connect but since your script is on your hosting I’m not sure why it can’t access the database.


#5

How can I check the status of the mysql server in the same spirit as [1]? Others [2] are facing problems connecting to mysql8.

[1] http://status.000webhost.com/
[2] Is there something wrong with mysql host: mysql8.000webhost.com


#6

I just use status.000webhost.com to keep an eye on uptime etc.

http://status.000webhost.com/778339538

As far as I can see the database server is still functioning?

http://sql8.000webhost.com/phpMyAdmin/


#7

Yes, phpmyadmin is working. This happened last time where phpmyadmin was working but was unable to connect with php [1]. Then, was able to connect the very next day.

Any changes to firewall rules at your end? or upgrades?

[1] Unable to mysqli_connect()@mysql8 today -- mysql8 down?


#8

Still down, James. I’ll try tomorrow to check if any change in status.


#9

When I try to open phpMyAdmin [2], it gives me a blank page. I do NOT see “mysql8.000webhost” anywhere on [1]. Others seem to have problems connecting [3,4]. Not sure what else I can do? reach out to community?

[1] http://status.000webhost.com/778339538
[2] http://sql8.000webhost.com/phpMyAdmin/
[3] Unable to connect to mysql with 000webhost
[4] Is there something wrong with mysql host: mysql8.000webhost.com


#10

Hopefully the staff member is resolving this issue.

https://www.000webhost.com/forum/t/is-there-something-wrong-with-mysql-host-mysql8-000webhost-com/

#11

I am also experiencing the same issue. I went through any other fix that I could find (change pwd, new db, even reinstalling wordpress), but no success.

This happens since 2 days ago on my side.


#12

Even more are affected by mysql8 down [1,2]. Down since 31st (dec 16).

[1] Is there something wrong with mysql host: mysql8.000webhost.com
[2] Mysql8.000webhost.com is down?


#13

i can now connect to MySQL. Thanks James for answering my queries. Thanks staff member for resolving this issue.


#14