+ Reply to Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Database Error

  1. #1
    heshma.patel41 is offline x10Hosting Member heshma.patel41 is an unknown quantity at this point
    Join Date
    Oct 2010
    Posts
    1

    Database Error

    Hi I have uploaded my website on my account with X10hosting.com but my site is not hosted properly i m getting error:Database Error: Unable to connect to the database:Could not connect to MySQL plz help me on this how to resolve this error... I really appreciate for u'r support
    Thanks

  2. #2
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Database Error

    Got your password right?

    ~Callum
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  3. #3
    aaron.is.me45 is offline x10Hosting Member aaron.is.me45 is an unknown quantity at this point
    Join Date
    Jun 2010
    Location
    Australia
    Posts
    10

    Re: Database Error

    Quote Originally Posted by heshma.patel41 View Post
    :Database Error: Unable to connect to the database:Could not connect to MySQL
    Things to check would be
    you have the correct password, the correct address of your mysql server, and that the user is actually connected to that database (if your using your main account name you shouldnt have that problem) and that your using your userid_databasename
    Last edited by aaron.is.me45; 11-06-2010 at 12:44 AM.

  4. #4
    dppas is offline x10Hosting Member dppas is an unknown quantity at this point
    Join Date
    May 2010
    Posts
    2

    Re: Database Error

    Thanks! that was helpful

  5. #5
    chance.brown65 is offline x10Hosting Member chance.brown65 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    9

    Re: Database Error

    I am seeming to have the same issue, I am also new

    trying to use PHP to connect to the MySQL database on x10hosting.com,

    not to sure if I got the server address correct, but that would be on myPHPadmin page on the right panel correct ? (IE: 10.33.249.7)



    Here is my PHO code, for obvious reasons I have substituted the password


    Code:
    <?php
    $con = mysql_connect("10.33.249.7","back2fro_username","password");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
     print "CONNECTED";
    
      
    
    mysql_close($con);
    ?>



    any help in getting connected would be perfect, the error I am getting is this, I do know my username and password are 100 correct, i reset them numerous times and created multiple users just as a test


    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'back2fro_username'@'int.web5.vital.x10hosting.com ' (using password: YES) in /home/back2fro/public_html/test.php on line 2

  6. #6
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Database Error

    you should ALWAY have host as "localhost" on our servers, anything else will fail.
    Last edited by Anna; 01-03-2011 at 03:20 PM. Reason: misleading typo
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  7. #7
    chance.brown65 is offline x10Hosting Member chance.brown65 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    9

    Re: Database Error

    Ok, so I changed my 2nd line of PHP code to show 'localhosr' and also tried 'localhost' as a test and came up with 2 errors

    localhosr - code error
    Code:
    Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'localhosr' (1) in /home/back2fro/public_html/OHL/asc1.php on line 2
    Could not connect: Unknown MySQL server host 'localhosr' (1)
    **Assumption: this hostname is incorrect, as then I tried localhost...

    localhost - code error

    Code:
    Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'back2fro_users'@'10.33.248.79' (using password: YES) in /home/back2fro/public_html/OHL/asc1.php on line 2
    Could not connect: Access denied for user 'back2fro_users'@'10.33.248.79' (using password: YES)



    ** here is the full PHP code again..

    I do understand my Username for x10hosting, which is 'back2fro' needs to be displayed at the beginning of my user who logins to sql so I created a user named "users". so i Put back2fro_users, and the password corresponding to that SQL user
    Code:
    <?php
    $con = mysql_connect("localhost","back2fro_users","password");
    if (!$con)
      {
      die('Could not connect: ' . mysql_error());
      }
    
     print "CONNECTED";
    
      
    
    mysql_close($con);
    ?>
    Last edited by chance.brown65; 01-03-2011 at 02:23 PM.

  8. #8
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Database Error

    If that would be what's located in your test.php, it seem to work fine now?

    And yes, sorry for the confusing typo I made.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

  9. #9
    chance.brown65 is offline x10Hosting Member chance.brown65 is an unknown quantity at this point
    Join Date
    Jan 2011
    Posts
    9

    Re: Database Error

    Yep, that is exactly it in my test.php

    I guess I must of had a space somewhere, my code works fine now after retyping it all out completely from scratch.


    thank you for the localhost info, was useful as well, previously I was using freehostingcloud and they have really slow servers, and after finding x10, I am interested in becoming a full member just because of the speeds!! but I shall wait till I finish past the first book of learning SQL/PHP for my iPhone apps.



    I hope I can provide some insight in the future on this forum regarding iPhone connection to PHP/MySQL databases on X10

  10. #10
    Anna's Avatar
    Anna is offline I am just me Anna is a name known to allAnna is a name known to all
    Join Date
    Aug 2007
    Location
    Sweden
    Posts
    6,569

    Re: Database Error

    quick note on that part, free hosting does not allow connection to the database from an outside source. In other words a webpage located in your account can connect fine, but connecting directly to the database from say your home computer will not work, which means that if the iPhone is to connect to the database directly it will fail in free hosting.
    Do you have trouble reaching your site?
    Check here first: News and Announcements


    Don't forget that x10hosting has an irc server as well. Come and join the fun
    server: irc.x10hosting.com, main channel: #x10hosting
    There's a lot helpful users there if need help building your site

+ Reply to Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 1
    Last Post: 10-12-2010, 12:17 PM
  2. Replies: 5
    Last Post: 04-25-2010, 04:02 PM
  3. Replies: 1
    Last Post: 04-17-2010, 12:26 PM
  4. Replies: 1
    Last Post: 11-23-2008, 04:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers