Submit Your Article Forum Rules

Results 1 to 4 of 4

Thread: Can't connect to new SQL database

  1. #1
    Senior Member
    Join Date
    Jul 2004
    Posts
    131

    Can't connect to new SQL database

    Hi guys, I just signed up with a new server and I'm having trouble connecting to the database.

    My current server is a windows based server and my new server is Linux. I want to fully test the database on the new server before I change the DNS.

    Here is the config.php file that I use for a few pages:

    CONFIG.PHP
    <?php

    $xxxConfig_dbhost = 'mysql.mywebsite.com';
    $xxxConfig_dbusername = 'sql@mywebsite.com';
    $xxxConfig_dbpasswd = 'password';
    $xxxConfig_database_name = 'database';

    ?>

    And here is the db.php file:

    DB.PHP
    <?
    /* Database Information - Required!! */
    /* -- Configure the Variables Below --*/

    require_once("config.php");

    /* Database Stuff, do not modify below this line */

    $connection = mysql_pconnect("$xxxConfig_dbhost","$xxxConfig_dbu sername","$xxxConfig_dbpasswd")
    or die ("Couldn't connect to server.");

    $db = mysql_select_db("$xxxConfig_database_name", $connection)
    or die("Couldn't select database.");
    ?>

    Of course I changed the real values but the syntax is the same.

    Now the new server that I'm trying to connect to is a Fedora Linux server. I tried to use the same code above to connect to the server using just the IP address because I want to fully test the site before I change the DNS. Here it is

    CONFIG.PHP (NEW)
    <?php

    $xxxConfig_dbhost = 'mysql.00.11.22.333';
    $xxxConfig_dbusername = 'sql';
    $xxxConfig_dbpasswd = 'password';
    $xxxConfig_database_name = 'database';

    ?>

    The only real difference here besides changing the IP address is that the new username doesn't have the @mywebsite.com after it. I assume this is a limitation of Linux.

    Am I doing this correctly? I feel like I've tried everything. Is it possible to connect to a database by IP only?

    I appreciate any help

    thanks

  2. #2
    Senior Member Faglork's Avatar
    Join Date
    Feb 2005
    Posts
    954

    Re: Can't connect to new SQL database

    Quote Originally Posted by spenland

    The only real difference here besides changing the IP address is that the new username doesn't have the @mywebsite.com after it. I assume this is a limitation of Linux.
    No. If at all, it would be a limitation of mysql.
    Quote Originally Posted by spenland
    Am I doing this correctly? I feel like I've tried everything. Is it possible to connect to a database by IP only?
    Try

    $xxxConfig_dbhost = 'localhost';

    Apart from that: Don't you get any error messages? Did you check server lof files?

    hth,
    faglork

  3. #3
    Senior Member
    Join Date
    Jul 2004
    Posts
    131
    Thanks faglork that seemed to do the trick. I owe you a beer next time I'm in Deutschland!

  4. #4
    Senior Member Faglork's Avatar
    Join Date
    Feb 2005
    Posts
    954
    Well, I live in the area with the highest density of breweries in the world, so we'd have plenty of choice ;-)

    Cheers,
    faglork

Similar Threads

  1. Google Friend Connect
    By gotabiz in forum Google Discussion Forum
    Replies: 4
    Last Post: 02-28-2009, 09:02 AM
  2. MySQL connect error to an outside database
    By getmea in forum Database Discussion Forum
    Replies: 5
    Last Post: 07-30-2008, 05:35 AM
  3. Can't connect to new SQL database
    By cyanide in forum Database Discussion Forum
    Replies: 0
    Last Post: 03-06-2006, 10:09 PM
  4. Cannot connect
    By loucipher7 in forum IT Discussion Forum
    Replies: 3
    Last Post: 02-28-2004, 10:21 AM
  5. Connect to each other => Dog fanciers
    By madinaki in forum Marketing Strategies Discussion Forum
    Replies: 0
    Last Post: 01-02-2004, 08:12 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •