+ Reply to Thread
Results 1 to 5 of 5

Thread: Can't connect to MySQL Database

  1. #1
    Darie is offline x10Hosting Member Darie is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    6

    Can't connect to MySQL Database

    Hello there !

    It doesn't matter what i try i cannot connect to the database i created in the cpanel.
    I'm trying to connect with a php-script to it, but the connection doesn't establish

    here is the script i use:

    <?php
    mysql_connect("absolut.x10hosting.com", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
    mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
    ?>

    i created the database with the mysql-center in the cpanel, database's name is shown as "darie_database"
    and i added a user called "darie_admin"

    Please help ! Thanx
    Darie
    Last edited by Darie; 10-19-2007 at 10:27 AM.

  2. #2
    gateway is offline x10 Sophmore gateway is an unknown quantity at this point
    Join Date
    Sep 2007
    Posts
    109

    Re: Can't connect to MySQL Database

    The php script is cool but I don't actually know what you are trying to install. but for many i know, these scripts has alternative config file that requires the information about your database. it seems you put this information in the wrong file. If the original file contains $db or $somenthing similar, then you do not have to replace it by your db user name or db. If no configuration file is available, then check the main file ( INDEX FILE) to see all file inclusions

  3. #3
    Darie is offline x10Hosting Member Darie is an unknown quantity at this point
    Join Date
    Oct 2007
    Posts
    6

    Re: Can't connect to MySQL Database

    Sorry, i don't understand what you are talking about... There is nothing i want to install.... (by the way isn't
    php pre-installed by the provider? Is is possible to config php through the cpanel?)
    I just have the script in my public folder and the commands were taken from a php-tutorial site (copy and paste party until i get used to php)
    By the way meanwhile i managed to connect with this script by replacing "absolut.x10hosting.com" with
    "localhost.x10hosting.com" and replacing the username "darie_admin" with my cpanel-username "darie".
    But i don't understand the logic behind using "localhost" instead of the serverhosts name "absolut".
    Using "absolut" doesn't work....but shouldn't it work too ?
    I also want to connect to the database from my computer to edit its contents with openoffice base.
    I use ODBC/MySQL Connector V.5 for it but i can't establish any connection to it !
    If there's an admin reading my post please post back. I've read in another posting that admins first have to
    open MySQL ports for connects from outside the domain. Please tell me if i am wrong !:cool:

    Greetz
    Darie

  4. #4
    FengFeng's Avatar
    FengFeng is offline x10Hosting Member FengFeng is an unknown quantity at this point
    Join Date
    Sep 2007
    Location
    China,Canton
    Posts
    59

    Re: Can't connect to MySQL Database

    Is the script localed in the web"absolut.x10hosting.com"??
    If the script is localed in it,try this:
    <?php
    mysql_connect("hostlocal", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
    mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
    ?>

  5. #5
    luni1's Avatar
    luni1 is offline x10Hosting Member luni1 is an unknown quantity at this point
    Join Date
    Oct 2007
    Location
    Lexington, Ky
    Posts
    81

    Re: Can't connect to MySQL Database

    shouldn't it be localhost instead of hostlocal?

    Is the script localed in the web"absolut.x10hosting.com"??
    If the script is localed in it,try this:
    Quote:
    <?php
    mysql_connect("hostlocal", "darie_admin", "****") or die ("ERROR: can't connect to mysql-server");
    mysql_select_db("darie_database") or die ("ERROR: can't connect to database");
    ?>
    but other then that looks fine...try it and see .....

+ Reply to Thread

Similar Threads

  1. [PHP] MySQL and PHP
    By Bryon in forum Tutorials
    Replies: 43
    Last Post: 03-24-2011, 07:27 AM
  2. MYSQL database
    By cabte in forum Free Hosting
    Replies: 4
    Last Post: 10-06-2007, 06:09 AM
  3. PHP BB 2.0.16 Manual instalation
    By GFIV in forum Free Hosting
    Replies: 8
    Last Post: 09-14-2005, 12:40 PM
  4. Could not connect to MySQL database?
    By chiamingen in forum Free Hosting
    Replies: 4
    Last Post: 03-16-2005, 07:12 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