Is there something wrong with mysql host: mysql8.000webhost.com

Hello everyone,

So for some odd reason I’ve can’t seem to connect to my database anymore from on today, it worked very well before, and I changed nothing.

Here’s a screenshot of the error:

Anyone got any idea?

Can you change your config file from mysql8.000webhost.com to just localhost?

To see if this cures the problem? :slight_smile:

Could you quickly explain how I can change the config file of that host? I don’t really know how to do that.

What script have you on your website?

I see this:

Okay sorry ignore my previous post do not attempt to try localhost, I thought you might be running on the new panel or moved over etc and you’d be needing to change but you don’t not yet anyway.

What script are you running?

Not really sure what script I’m running, how can I check this? (I’m a newbie, sorry :D)

It all used to work up untill today, suddenly I got problems with my DB connection.

Like what was running on your site?

WordPress, a forum like SMF/phpBB or maybe a CMS like Joomla or something?

It’s just a simple website I created myself, no scripts. Just plain selfcoded things

This is my complete public_html map :smiley:

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";
?>

Allright.

Using the first method it seems to be showing the website, but there’s still an error message on top which makes me believe my connection failed:

Using the second method:

Warning: mysqli_connect() [function.mysqli-connect]: (HY000/2003): Can't connect to MySQL server on 'mysql8.000webhost.com' (113) in /home/a1890108/public_html/base.php on line 8

Free Web Hosting
Connection failed: Can't connect to MySQL server on 'mysql8.000webhost.com' (113)

Same error using the third method, I’m at my wits end :S

There must be a configuration error somewhere between your website and the database (not saying your at fault, but possibly 000webhost configurations)
Hopefully this will be resolved soon by their technical team.

Is there something I can do about this to check it out?

You could shoot a message to https://www.000webhost.com/forum/users/vaidas/activity
Or another administrator https://www.000webhost.com/forum/users/giedrius/activity plus andrius and they might advise/be able to fix it.

I messaged them! I hope I get a reply soon. I have to show this website in about 10 days before a school jury :smiley: Nothing special but still

If you have a backup of your files you could easily visit 000webhost.com, signup a new account with a new email and re-upload your files, then you would be able to use the script straight away as you’d be on the new control panel which uses localhost as the hostname instead of set servers like mysql8 etc

I have the same problem. Were you able to fix the problem? I thing the administrator changed something on MySql server.

This problem was reported before and closed. It came up again. It has to do with changes in MySql server. My connection has been working fine.

Do you still experience any issues?

I’m experiencing the same issues again with mysql8 seems I cannot connect to the server I’m on the old Cpanel been like that for about 3 days now
http://www.breezeserve.net/securex/management/login.php