Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4251614
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:41:06+00:00 2026-05-21T04:41:06+00:00

I have a MySQL database set up on 000webhost.com. I want to access the

  • 0

I have a MySQL database set up on 000webhost.com. I want to access the data in my database via PHP. I tried:

<?php 

include("connect.php");
mysql_select_db("XXXXXXX_users", $con) or die(mysql_error()); 

$result = mysql_query("SELECT * FROM data ORDER BY id DESC");
while($row = mysql_fetch_array($result))     
{
    $id = $row['id'];
    $user = $row['usrname'];
} 


echo "$user";
?>

But it always returns as: “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.”

What do I do?

  • I do not have root access
  • I’m trying to run the script on Apache
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:41:07+00:00Added an answer on May 21, 2026 at 4:41 am

    When debugging this sort of thing, it’s always good to make sure you can connect using the command line mysql tool first, to rule out issues related to PHP itself.

    $ mysql -u myuser -h mysql.example.com -p
    

    You’ll get a more descriptive error message as well, e.g. ERROR 1045 (28000): Access denied for user 'root'@'remote.example.com' (using password: YES)

    If the mysql port is even open on a public interface to begin with (which is usually a terrible idea), mysql itself has its own layer of access control based on the connecting host. You may need to have an account created specifically with a wildcard hostname, like so:

    CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypassword';
    

    The @'%' part, specifically, allows connection from any host, local or remote.

    Once you can successfully connect from the command line, it’s then a simple issue of replicating your command line arguments as arguments to mysql_connect()

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a mysql database set as utf-8, and csv data set as utf-8,
I am trying to use sqlalchemy to connect with mysql database. I have set
I have a MySQL database/table set up and a .php file online that inserts
I have a MySQL database behind a firewall which can only be accessed via
I have a MySQL database of keywords that are presently mixed-case. However, I want
I have a MySQL database that I want to archive . What is the
Okay, so I have a MySQL database set up. Most of the tables are
I am using Access 2007 and have some linked tables to a mySQL database.
I need to connect to a remote MySQL database and have created the following
I have a server attempting to connect to a MySQL database hosted outside of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.