Welcome Guest ( Log In | Register )



 
Reply to this topicStart new topic
> Problem With MySQL Not Being Able To Connect, Anyone know the reason for this error...
kgd2006
post Apr 8 2006, 06:45 AM
Post #1


Premium Member
Group Icon

Group: [HOSTED]
Posts: 318
Joined: 1-March 06
Member No.: 11,638



Hello everyone,

Im currently having a problem with mySQL, I wrote a PHP login script that doesnt seem to be working for some reason. I created a database and everything looks correct, is this a server issue or is the issue related to my script? But anyway this is my error, hope someone can help Ive tried to search forum for answer but none of the posts seems to answer my question:

QUOTE
Warning: mysql_connect(): Host 'gamma.xisto.com' is not allowed to connect to this MySQL server in /home/hp2001/public_html/ucscKGD/checklogin.php on line 10
cannot connect


I set the $host=astahost.com, would it be $host=gamma, which is the server my site is at. I tried both and still recieve error...Hope someone can help me...
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Apr 8 2006, 06:52 AM
Post #2


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411



Nope - your host should be yoursubdomain.astahost.com. Maybe that's where it's going wrong - it's trying to connect to the MySQL DB's of the main astahost.com domain.

Try adding in your own subdomain before that and write back if it works. smile.gif
Go to the top of the page
 
+Quote Post
kgd2006
post Apr 8 2006, 07:03 AM
Post #3


Premium Member
Group Icon

Group: [HOSTED]
Posts: 318
Joined: 1-March 06
Member No.: 11,638



Nope doesnt look like its working...hmmm cant be my code, cause its the same code I used at another free hosting server, just that I have to modify the correct hosting variable...hmmm...but this is wut i get when I change the $host="hp2001.astahost.com"

QUOTE
Warning: mysql_connect(): Host 'gamma.xisto.com' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/hp2001/public_html/ucscKGD/checklogin.php on line 10
cannot connect


from the search results I checked on the forum people talked about overloads of the mySQL server, could that be it...the error doesnt seem to make sense if its a mySWL server overload problem...
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Apr 8 2006, 07:10 AM
Post #4


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411



I don't think it's an overload problem - coz my site (Antilost) is loading fine, and it's hosted on Gamma. Can you paste the connection part of your script here ? That might give me an idea..

However - on second thoughts, Host 'gamma.xisto.com' is blocked because of many connection errors. - that statement does indicate a temporary lockup owing to too many persistent connections.

Lets wait up for sometime and see if it gets fixed. Usually such overloads are auto-resolved within 15 minutes or maybe a bit more sometimes.
Go to the top of the page
 
+Quote Post
kgd2006
post Apr 8 2006, 07:12 AM
Post #5


Premium Member
Group Icon

Group: [HOSTED]
Posts: 318
Joined: 1-March 06
Member No.: 11,638



Hmm...wonder whats wrong, well heres my script:

CODE
<?php
ob_start();
$host="hp2001.astahost.com"; // Host name
$username="hp2001"; // Mysql username
$password="********"; // Mysql password
$db_name="hp2001_ucscKGD"; // Database name
$tbl_name="members"; // Table name

// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");

// Define $myusername and $mypassword
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];

$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);

// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row

if($count==1){
// Register $myusername and redirect to file "members.php"
session_register("myusername");
header("location:members.php");
}
else {
header("location:incorrectUP.php");
}

ob_end_flush();
?>
Go to the top of the page
 
+Quote Post
miCRoSCoPiC^eaRt...
post Apr 8 2006, 07:29 AM
Post #6


PsYcheDeLiC dR3aMeR
Group Icon

Group: Admin
Posts: 2,242
Joined: 29-January 05
From: Nakorn Chaisri, Thailand
Member No.: 2,411



The code seems absolutely fine except for one little mistake..
CODE

$host="hp2001.astahost.com"; // Host name
$username="hp2001"; // Mysql username
$password="********"; // Mysql password
$db_name="hp2001_ucscKGD"; // Database name
$tbl_name="members"; // Table name


Notice that for $db_name - you've prefixed the database name with hp2001 - which is your cPanel username. Similarly, for $username - you'll have to prefix your MySQL DB username, with another hp2001. So it should be $username = "hp2001_hp2001"

By default whenever you create a new MySQL DB and a username for it, they're both prefixed with your cPanel username.

Try that and let me know - although, if it was a problem with the username, the error message should have said so. Seems like it's not connecting in the first place. Still give it a try and let me know.
Go to the top of the page
 
+Quote Post
kgd2006
post Apr 8 2006, 09:26 AM
Post #7


Premium Member
Group Icon

Group: [HOSTED]
Posts: 318
Joined: 1-March 06
Member No.: 11,638



I tried wut u suggested and it still has the same problem, and is there a way to unblock? I can seem to find the phpadmin to flush the block...I guess Ill just retry tomrrow when its free from the block...
Go to the top of the page
 
+Quote Post
Houdini
post Apr 8 2006, 05:18 PM
Post #8


Super Member
Group Icon

Group: Members
Posts: 572
Joined: 25-April 05
From: Nashville Tennessee
Member No.: 4,340



Try "localhost" for the host name it works fine for me
QUOTE
$host="hp2001.astahost.com"; // Host name
$username="hp2001"; // Mysql username
$password="********"; // Mysql password
$db_name="hp2001_ucscKGD"; // Database name
$tbl_name="members"; // Table name
change it to
CODE
$host="localhost"; // Host name
$username="hp2001"; // Mysql username (make this your username that you login to cPanel with)
$password="********"; // Mysql password(make this the password you login to astahost cPanel with)
$db_name="hp2001_ucscKGD"; // Database name
$tbl_name="members"; // Table name
Go to the top of the page
 
+Quote Post
kgd2006
post Apr 8 2006, 05:59 PM
Post #9


Premium Member
Group Icon

Group: [HOSTED]
Posts: 318
Joined: 1-March 06
Member No.: 11,638



but would localhost...be if you are hosting it privately on your machine with a setup apache server, cause I use localhost as the value when I am testing php scripts on my computer. For webhosts it should be the hostname of the server...I cant seem to get it working, I can get this script working successfully at another freehosting site but how come Im gettin problems here? I will try put localhost, im up to try anything right now...haha...

EDIT>>WOW...HOUDINI...YOU ARE THE MAN!!! Haha, it worked...odd tho, how the hostname would be localhost, I would think the name be the servers hostname...

This post has been edited by kgd2006: Apr 8 2006, 05:59 PM
Go to the top of the page
 
+Quote Post
Houdini
post Apr 8 2006, 08:39 PM
Post #10


Super Member
Group Icon

Group: Members
Posts: 572
Joined: 25-April 05
From: Nashville Tennessee
Member No.: 4,340



That is because normally MySQL runs as localhost, there is one host that I must connect to as mysql not localhost. Most of the time localhost is fine it is the username and password that matter to the MySQL server.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Error 406 - Problem In My Phpbb Forum(8)
  2. Recover Tables From A MySQL .frm File(8)
  3. How To Connect Dual/triple Monitor + Advantages(21)
  4. MySQL Output Database Question(18)
  5. Photoshop Cropping Problem(6)
  6. MySQL, Multiple Tables(24)
  7. PHP & MySQL: Displaying Content From A Given ID(6)
  8. Problem With Drag And Drop (or So It Seems).(11)
  9. Navcat For MySQL(8)
  10. Win Rar Password Problem(7)
  11. Qupis : Free Cpanel Web Hosting (one Line Text Ad At Bottom)(10)
  12. Trojan / Virus Problem ,please Help(18)
  13. A Gaiaonline Problem(9)
  14. Login System Using A Mysql Db(5)
  15. Bid For Power Opengl Error [solved](6)
  1. Administrator Account Problem In Microsoft Xp [solved](20)
  2. Java Applet Loading Error(5)
  3. Strange Error When Trying To Install Fedora Core 9(5)
  4. Bluetooth Software(3)
  5. Mysql Database Entry By Excel Sheets(2)
  6. Mysql On Computer(9)
  7. How To: Display A Members/user List.(3)
  8. Any Website Provide Free Host Mysql Host?(4)
  9. Mysql Multiple Tables(1)
  10. Common Ftp Server Error Codes(0)
  11. Error Connecting To Domain(2)
  12. Cant Find The Error(2)
  13. What You Need Before You Can Create A Text-based Game..(5)


 



- Lo-Fi Version Time is now: 30th August 2008 - 03:21 PM