WebProWorld Part of WebProNews.com
Page One Link To Us Edit Profile Private Messages Archives FAQ RSS Feeds  
 

Go Back   WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Subscribe to the Newsletter FREE!


Register FAQ Members List Calendar Arcade Chatbox Mark Forums Read

Database Discussion Forum This is the place to find help resolving those nagging questions you have about implementing and using all kinds of databases. Need help writing a query? Need an opinion on Oracle? Post here!

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-06-2006, 07:24 PM
WebProWorld Pro
 

Join Date: Jul 2004
Location: Irvine, CA
Posts: 120
spenland RepRank 0
Default 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
Reply With Quote
  #2 (permalink)  
Old 03-07-2006, 05:50 AM
Faglork's Avatar
WebProWorld Veteran
 

Join Date: Feb 2005
Location: Forchheim, Germany
Posts: 947
Faglork RepRank 0
Default 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
Reply With Quote
  #3 (permalink)  
Old 03-07-2006, 11:48 AM
WebProWorld Pro
 

Join Date: Jul 2004
Location: Irvine, CA
Posts: 120
spenland RepRank 0
Default

Thanks faglork that seemed to do the trick. I owe you a beer next time I'm in Deutschland!
Reply With Quote
  #4 (permalink)  
Old 03-27-2006, 05:52 AM
Faglork's Avatar
WebProWorld Veteran
 

Join Date: Feb 2005
Location: Forchheim, Germany
Posts: 947
Faglork RepRank 0
Default

Well, I live in the area with the highest density of breweries in the world, so we'd have plenty of choice ;-)

Cheers,
faglork
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Database Discussion Forum
Tags: , ,



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Search Engine Optimization by vBSEO 3.2.0