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
Submit Your Article
Forum Rules

Reply With Quote