SQL Connection Refused


I keep getting the error “SQLSTATE[HY000] [2002] Connection refused” when I enter my SQL information into my website configuration. I have no trouble getting into my database through phpMyAdmin and I’ve verified that all the information I’m entering is correct multiple times, tried creating a new database to use, and I’ve even tried re-uploading my files. Nothing is working, can someone please help me?

SQLSTATE[HY000] [2002] Connection Refused

@Halfwolf Make sure you’re using “localhost” as your hostname.

You can database related information from “Manage Database”.


I tried both “localhost” and “” as the hostname and neither worked.


@Halfwolf is the issue solved??


Try making a new database, user and password and running a few test scripts from the tutorial section.


@akhilkumar332 No, it has not.

@Infinity I’m not seeing any test scripts in the tutorial section (perhaps I missed it?), can you provide a link? Also, I have tried making a new database several times and that didn’t solve my issue.

To add a bit more detail behind the issue, I’m trying to migrate a website that uses E107 CMS. It was working fine prior to migration, but I cannot update the database configuration. I tried editing it myself to match the new database and I got a 500 internal server error. I then tried to re-create the configuration file using their E107’s Install PHP, which produced the “SQLSTATE” error. Additionally, I tried to set up a completely clean installation of E107 (meaning only the files that come with it are being used) with a new, untouched database and instead got a 500 error. If anyone can think of anything, please let me know.


This post was flagged by the community and is temporarily hidden.


@Captainjjjacksparrow Yes, I’m using a free plan. However, my website worked fine using 000webhost prior to migration. I’ve used E107 here for about 5+ years without any major issues.


Sorry I was on mobile device when replying so it wasn’t that easy to link.

Have a try with these methods to ensure your site has proper connection to the database.


Weird I’ve managed to install an older version of E107, but not the latest version.



But using the latest download from E107 it won’t work.

I think I’ll head over to the support forums if I get time and post up a question asking why is this happening, how to resolve it.

With regards to it not working on free hosting maybe the new version I am trying to install has higher requirements than free hosting so premium might be an option…


Oh so I just used the latest installation on a premium account and the script works fine.

So until anyone else finds an option to fix this I’d recommend e107 on the list of unsupported scripts for free hosting accounts and to use it on premium only.


https://gitter.im/e107inc/e107 Join the chat maybe we can resolve something today…


@infinity Thank you so much for the followup, I will join in when I can. I could’ve sworn that the update resources provided by 000webhost met the requirements for the newest version.That’s actually what excited most about the migration was finally being able to upgrade. Perhaps I either misread the requirements or what is provided in the free service. As posted on E107’s website, the latest version requires the following:


  • A Web-Server (Apache or Microsoft IIS) running PHP v5.4 or higher and MySQL 4.x or 5.x.
  • FTP access to your webserver and an FTP program such as Filezilla
  • Username/Password to your MySQL Database


  • A Linux based Webserver running Apache 2.x, PHP 5.6 or higher (including PHP 7), MySQL 5.0 or higher. (LAMP)
  • A registered Domain Name
  • Access to a Server Control Panel (such as cPanel)

If I was wrong about at least the minimum requirements being met, please let me know.


So the friendly bunch at E107 have replied and have found an issue and are fixing it I believe… stay tuned.


@Halfwolf Download “E107 CMS” from the link below and install.
(*Note:- Developers of e107 has solved the issue and now it is woking fine with 000webhost.)

If you’ve any issues post back or PM me.


@akhilkumar332 Thank you, it connects to the database during installation. However, after I finished setting up my website, I get this message:

Application error
An error occurred in the website and your page could not be displayed. If you are the website owner, check your logs for details.

I couldn’t find the log it mentions, otherwise I’d paste it here. The message does appear to be generated by 000webhost though, as its logo appears in the bottom left of the page.


@akhilkumar332 Delete .htaccess file and see if it works.
If not then delete the website from “settings” --> “General”, and then create it again…
And then install e107 again.
Remember don’t paste any values or scripts in .htaccess file.

Or PM me your login details…i can do it for you :slight_smile:


@akhilkumar332 It worked! Thank you so much for your help (you too @Infinity)! Once the database issue is fixed I’ll try uploading my old one and see if I can get it that to work as well, as I was using a new database for the install. I’ll let you know how that goes. Thank again for the help!


@Halfwolf All credits to infinity…because he was the one who informed developer of e107 about this issue and finally get this thing to work with 000webhost new panel.