Nov 21, 2009

Problem With MySQL Not Being Able To Connect - Anyone know the reason for this error...

free web hosting
Open Discussion & Free Web Hosting > Astahost > Hosted Members Support

Problem With MySQL Not Being Able To Connect - Anyone know the reason for this error...

kgd2006
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...

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
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

Comment/Reply (w/o sign-up)

kgd2006
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...

Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
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.

Comment/Reply (w/o sign-up)

kgd2006
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();
?>

 

 

 


Comment/Reply (w/o sign-up)

miCRoSCoPiC^eaRthLinG
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.

Comment/Reply (w/o sign-up)

kgd2006
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...

Comment/Reply (w/o sign-up)

Houdini
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

Comment/Reply (w/o sign-up)

kgd2006
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...

Comment/Reply (w/o sign-up)

Houdini
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.

Comment/Reply (w/o sign-up)


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

This textarea will convert to Rich-Text automatically (IE, Firefox, Chrome)

Similar Topics

Keywords : problem, mysql, connect, reason, error

  1. Connecting To Astahost's Mysql
    (8)
  2. Mysql Server Not Stable After Hard Disk Swap On April 6th
    (2)
    Hi... All are aware of the server issues happened on April 6th:
    http://www.astahost.com/current-server-iss...ade-t15435.html I'm still facing the issue with
    the MySQL Server after the server problems!! I'm using phpBB forum for my site, and it often
    shows some error message after losing connection with the Database server! Its happening many times
    in a minute! Its not at all stable after the server issues! I had tried repairing the databases and
    optimizing the databases! But nothing helped me! Still facing the issues! Its showing like:
    DEBUG MODE ....
  3. Strange Error (maybe Directoryindex Glitch?)
    (6)
    So if I browse to my site, www.ethergeek.com it takes me to a download window which proceeds to
    download the PHP page from the server. If I type www.ethergeek.com/index.php the page loads as
    expected. This happens in other folders too...it almost seems like if the server looks at
    DirectoryIndex parameter it doesn't pass the page through the php preprocessor... Any ideas?....
  4. Site Not Opeing ( Phpbb Forum) :: Can't Connect To Local Mysql
    (3)
    Hi all, Please help me! My site was working fine! ( www.fun.niranvv.com ) But now, its showing
    one error message as: Warning: mysql_connect() : Can't connect to local MySQL server
    through socket '/var/lib/mysql/mysql.sock' (2) in
    /home/niranvv/public_html/fun/db/mysql4.php on line 48 Warning: mysql_error(): supplied argument is
    not a valid MySQL-Link resource in /home/niranvv/public_html/fun/db/mysql4.php on line 330 Warning:
    mysql_errno(): supplied argument is not a valid MySQL-Link resource in
    /home/niranvv/public_html/fun/db/mysql4.php on line....
  5. Server Or Me?
    I have an error? It doesn't look like anyone else has it? (5)
    OK I don't know if this is the right place for this so could the mods move it the the correct
    place? Thanks. Whenever I try to access my website or log onto the control pannel I get the
    following error message: QUOTE Network Error (tcp_error) A communication error occurred:
    "Operation timed out" The Web Server may be down, too busy, or experiencing other problems
    preventing it from responding to requests. You may wish to try again at a later time. For
    assistance, contact your network support team. It says contact support team (I assume thats
    you). Is an....
  6. What Is The MySQL Version @ Asta ?
    MySQL 4.0.26-Max
    (16)
    Hi, A few question here, 1. Just wondering, the MySQL hosted on astahost.com is actually version
    "4.0.26-Max" according to phpmyadmin. But why is cPanel showing "4.1.21-standard"? 2. Actually
    i've existing codes that need function introduced after version 4.1.1, is there by any chance
    astahost or xisto is going to upgrade the MySQL package? Thanks....
  7. Problem With MySQL
    (5)
    I tried to visit my website today and I recieved the dreadful page from my php-nuke site "There
    seems to be a problem with the MySQL database" First I thought, "no big deal server is probably
    rebooting or down for a little bit" So i logged into my cpanel and clicked on "Server Status".
    Thats when I started worrying. It said the MySQL servers were up and runnign fine. I went back to my
    main page and looked at my MySQL server count and instead of saying 2/99 it now says NA/99 I am
    unable to create a new database and I recieve this error when I click on PHPmyadmin QUO....
  8. Problems With cPanel
    Showing some error message (9)
    Hi all, I was trying to upload some files to my account using cpanel! There was no problem in the
    beginning! But suddently it shows one error message as: Sorry for the inconvenience!
    The filesystem mounted at / on this server is running out of disk space. cPanel operation has been
    temporarily suspended to prevent something bad from happening. Please ask your system admin to
    remove any files not in use on that partition. (Edit: Authentication is working fine! After
    authentication only, ith shows the error message like this! ) Please check this one: htt....
  9. Php And Mysql Version.
    (7)
    Is there any plan to upgrade or see if it can be upgraded to PHP5 and mySQL5 in the future?....
  10. Mysql Connect Error, Too Many Connections.
    (1)
    Just to begin with I want to say that I am not here necessarily to complain about it lol. I'm
    not sure but if my site is possibly helping to contribute to the problem, I'd like to know if
    anyone knows any good articles or tutorials that might have information on what to look out for that
    could contribute to these sort of problems. I know my site may not have anything to do with it (as
    I don't think it is overly popular or anything or even close), but knowing what to look out for
    when messing with PHP/mySQL would be great. I personally haven't found too....
  11. Mysql Error Never Seen On My Site Before (too Many Connections).
    (13)
    I just tried to visit my site to see if anything had changed on my forums and such and I got this
    message: Warning: mysql_connect(): Too many connections in /xxxx/xxxxx/xxxxxx_xxxxx/xxx/xx_xxxx.php
    on line 7 Error! Could not connect: Too many connections. I have never recieved this error before,
    does this mean someone is mucking with my site somehow??? The particular php file it mentions is
    the one that defines variables like db username etc and connection to the site's database that I
    include wherever it is needed in various file for the site. EDIT: I managed t....
  12. Error Accessing Forum Topics
    Can't access certain forum topics (1)
    Hi. I have been experiencing difficulty accessing certain forum topics. This started quite some time
    back, but I always thought that the forum topics have been completely deleted, thus I'm not able
    to access it. Now, however, I just saw a forum topic that I could not access previously being in the
    last post column. I tried again but still I could not access it. The forum topic in this case is
    "Shoutbox Display Names". Any help would be appreciated. Thanx.....
  13. Site Unavailable!
    Server Timeout error! (7)
    My Astahost Website seems to be unavailable currently. The Time is : 4:15 PM IST (GMT+5:30hrs)
    The browser gives a "Server Timeout Error". Is this a temporary server downtime, or do I have to
    re-configure my site or something? I also have enough credits to go on with - 17 at this time...
    My site is : www.omkarshub.astahost.com ....
  14. Help Me!
    Frontpage & phpBB with MySQL (3)
    I was just approved an Astahost account with the starter package. I explored the Cpanel a bit
    and have got the following problems : 1.Frontpage Extensions The Cpanel states that the
    Frontpage Extensions have been installed. But when I uploaded my site on frontpage at
    "ftp://ftp.mysitename.astahost.com/public_html/" it stated an error that Fronpage Extensions are not
    installed on this server! When I opened my site online, I can see the page, but I cannot see any
    graphics/images! Also, my forms and other stuff isn't working either. Please help me out and let
    me....
  15. Problems With PHP/Joomla On Hosted Site
    PHP sevred pages are blank in Firefox, network error in Safari (9)
    I am having some odd problems with my hosted site. They started sometime yesterday. I have not made
    any changes for about two weeks. In Firefox, the index page (index.php) for Joomla comes up blank.
    I can access my Control Panel and can check that the files are there and look correct. No favorites
    icon is displayed either and the page source is empty. In Safari, I get the favorites icon but then
    get a network error and a blank page ("Safari can’t open the page “http://mistymanor.astahost.com/”.
    The error was: “lost network connection” (NSURLErrorDomain:-1005) Please cho....
  16. Mail Delevery System Error
    error (6)
    whenever i try to send an email, no matter where, from any of the accounts that i create in cpanel,
    i always get this error at the destinatary: QUOTE This message was created automatically by
    mail delivery software. A message that you sent could not be delivered to one or more of its
    recipients. This is a permanent error. The following address(es) failed: mustra@sapo.pt SMTP
    error from remote mail server after MAIL FROM: SIZE=1668: host mx.ptmail.sapo.pt : 554 sorry,
    your IP is rejected because it was flagged as an open-relay or abuser; o seu IP foi re....
  17. Weird MySQL Message
    (4)
    wenever i assign priviledges to a MySQL databases, it seems to work properly but this message is
    always there QUOTE bitshift_wforumu (Privileges: ALL PRIVILEGES) Connection Strings
    Perl $dbh = DBI->connect("DBI:mysql:bitshift_wforum:localhost","bitshift_wforumu"," ");
    PHP $dbh=mysql_connect ("localhost", "bitshift_wforumu", " ") or die ('I cannot connect to the
    database because: ' . mysql_error()); mysql_select_db ("bitshift_wforum"); My database
    name is: bitshift_wforum the username is: bitshift_wforumu What does all that maen, it ....
  18. MySQL - Can't Connect
    Cristal Report (1)
    From http://thoaionline.com (hosted by Astahost) QUOTE Warning: mysql_connect(): Can't
    connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) in
    /home/pheart/public_html/thoaionline/includes/database.mysql.inc on line 31 Can't connect to
    local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) In cPanel Mysql
    databases 0 / 99 But I have 5 MySQL databases in my account (maybe more). All of them become
    unusable now. Some more messages from http://website.thoaionline.com QUOTE Warning: 
    mysql_pc....
  19. Can I Access MySQL Database From Outsite, Directly
    (10)
    I'm going to make an OFFLINE FORUM. So I want to know is that possible or not. My paid host
    don't allow that. How about astahost?....
  20. Wrong Password/username - Fatal Error In Horde
    (5)
    I keep getting a fatal error when trying to check my webmail using Horde, through the CPanel. Also,
    when I try to open PhpMyAdmin I get an error saying "Wrong username/password. Access denied."
    However, I'm logged into CPanel fine, and after getting this error I changed my password. That
    went fine, as well. This is really annoying, I'm locked out of some stuff I sorta need access
    too. Anyone able to help?....
  21. IPS Driver Error / MySQL Database
    What in the world? How is this possible? (1)
    Just several hours ago, I couldn't access my website/forum because of some error with an SQL
    socket or something like that. I need desperate help because I don't want to reformat everything
    again. Well, here is what comes up: IPB WARNING mysql_connect(): Can't connect to local
    MySQL server through socket '/var/lib/mysql/mysql.sock' (2) (Line: 114 of
    /ips_kernel/class_db_mysql.php) There appears to be an error with the database. You can
    try to refresh the page by clicking here. Error Returned: SQL error: Can't connect to local
    M....
  22. MySQL Database
    Important Report (3)
    I'm writing this to report about a error. One of my mySQL database has been droped and my site
    stop working. I don't know the reason. I'm hosted on gamma server. I think you (admin)
    should check it. PS: One of my paid hosting provider also met this problem a few day ago.....
  23. Upgrade Error
    Error while upgrading hosting account (3)
    Got this while trying to upgrade account .. Verfied.. Upgrading.. Connection Initilized... Secure
    Socket Not Found. Continuing without SSL... Authorization Succeded.. Commands Executed.. Printing
    out REturned DATA!. There were problems creating your account! Please Contact Administrator. And
    it talks about bug info but doesnt show any .. so, err. Whats goin on?....
  24. My Site
    error accessing my site hosted here (5)
    Today at local time GMT+1 --> 15:12 I could not access my site http://www.final-design.net hosted
    here at Astahost. error looks as follows: QUOTE The page cannot be displayed The page you are
    looking for is currently unavailable. The Web site might be experiencing technical difficulties, or
    you may need to adjust your browser settings. I hope you'll fix that soon. Thanks to
    admins in advance.....
  25. Php Parsing Error On Smf On My Site
    Parse error: parse error, unexpected T_C (16)
    QUOTE Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in
    /home/jeremy1/public_html/guild_forum/Sources/Subs.php on line 272 thats the error I get when
    people try to access the forums I run on my website. I've been through the code but can't
    figure out exactly whats wrong. I'm still quite new to PHP and still have a very limited
    understanding of it. All I can say for certin is that up untill around 2 p.m. PST the forums were
    working then around that time they seem to have stopped and started outputing that error message.
    If anyone c....
  26. Problem With Mysql
    Cannot connect to database.... (6)
    Hi, this is the first time after I got my hosting to try and use MySQL. My site is
    http://abhiram.astahost.com . I created a user in CPanel -> 'MySQL Databases' as root. So,
    the new user created will be 'abhiram_root'. Similarly I created a database called
    'webpage' (which changes to 'abhiram_webpage'). I set up the database and the tables
    using phpMyAdmin and uploaded the files after making changes to the user name and the database. But
    it's not opening the database. It's connecting to MySQL without any problems, but it
    isn'....
  27. Mysql Error
    (5)
    Hey i got this error trying to install something on my database CODE mysql error: You have an
    error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the
    right syntax to use near 'rpg_class` (`name`, `folder`, `regatt`, `magicatt`, `magicdef` mysql
    error number: 1064 can anyone tell me what this means or how i fix it?? thanks in advance....
  28. MySQL Errors? - Error 13!
    (0)
    Recently been attacked by "Can't create/write to file '/tmp/#sql_28e2_0.MYI' (Errcode:
    13)"? Then its a simple fix, please DELETE (backup first) your SOURCE files that talk to the MySQL
    database, and re-upload them This will purge them from the system and force them to recreate the
    temporary files. Do NOT delete your database, just backup your files, delete them, re-upload them
    and youll be fine. This is due to MySQL crash. Easily fixed and no data has been lost. Sorry guys
    Details: MySQL crashed while writing data, it seems the temporary file has bee....
  29. General Problems With New Account
    MySQL problems and quota issues (2)
    I just got a new account and CPanel reports that I have -380.2 MB of quota space and using 400.2MB.
    This disables some of Cpanel's functions. It would have been nice to use the automated Mambo
    installer, but no biggy. I uploaded the latest Mambo .tar.gz from my FTP program and unpacked it
    via Cpanel's file manager with no problem. When I first logged into the system I created a new
    Database for mambo and a new user for that database and linked the two from Cpanel. I logged off to
    watch something on TV and came back and that database isn't being reported....
  30. Internal Server Error
    500 Internal Server Error (6)
    I got the following error page when trying to access cpaanel and my cgi-bin: QUOTE Internal
    Server Error The server encountered an internal error or misconfiguration and was unable to complete
    your request. Please contact the server administrator, webmaster@coolbusinessideas.com and inform
    them of the time the error occurred, and anything you might have done that may have caused the
    error. More information about this error may be available in the server error log. Additionally, a
    404 Not Found error was encountered while trying to use an ErrorDocument to handle ....

    1. Looking for problem, mysql, connect, reason, error

See Also,

*SIMILAR VIDEOS*
Searching Video's for problem, mysql, connect, reason, error
advertisement



Problem With MySQL Not Being Able To Connect - Anyone know the reason for this error...

Affordable Web Hosting, Low cost Web Hosting - ComputingHost.com