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

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

I also cannot access my website anymore (www.dental-tutors.com). I didnt change anything to any login details or anything at all for the last 1 month and it was working without problems. Just today I noticed that I get an error “Error establishing a database connection”

seems like mysql8.000webhost.com is down. please check

P.S. I can access my ftp through filezilla.

Thanks

Yes, I am. I can access the database through the admin and make queries but I cannot access it in the browser.

Is anyone else still having this issue? I’ve tried all three methods for connecting to the database using PHP in the tutorials and none of them work. I’m always getting the same error message as the other people in this post. My mysql database host is also mysql8.000webhost.com, so at this point I’m thinking it’s not a coincidence.

Can you provide a screenshot of your 000webhost.com database page?

1 Like

Screenshot attached…

1 Like

Are you able to try this tutorial out using the information from your screenshot?

1 Like

I actually had to use a different email address to create a new account to get the issue resolved. My old account was bringing me to this old cpanel, and I guess that’s where the problem was because I can connect with the same code in my new account (with the connection information updated, of course) no problem.

1 Like