Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 05-10-2006, 10:27 AM
MikeinSC MikeinSC is offline
Hatchling Croc
 
Join Date: Apr 2006
Posts: 18
Default Need Assistanc with Config.php, plus, a mysql question

I recently downloaded a free PHP website I found off a site. I want to play around with PHP and mysql. I am an html guy, so, PHP is new ground for me. Upon reading the instructions, it said to create a database, which I did. I also created a user for the database, and assigned the user to the database with all privileges checked (the all checkbox). The instructions then said to modify the config.php file so it corresponds with the site. This is where I am having a problem. I am unsure what to replace the data with based upon my database.

Here is what I see:

$dbhost = 'localhost';
$dbuser = 'db_user';
$dbpass = 'test';
$dbname = 'db_name';
$admin_name = 'admin';
$admin_pass = 'admin';
$admin_email = 'test@testsite.com';
$site_name = 'My Website';
$site_slogan = 'My Website';
$site_title = 'My Website Service';
$site_copyright = 'My Website Service';

Questions:

1.) Do I change 'localhost' to my main domain name, or, leave it alone?

2.) When I created the mysql database, it preceded the name with my username I use when logging into hostgator. Should I use that name, along with the name I gave the database when referring to the database? For example, 'username_mydatabasename', or, 'mydatabasename' ? Does this also apply to the user I created for the database? 'mydatabasename_databaseuser', or, would I use just 'databaseuser' to represent the assigned user to the database?

3.) Do I leave 'admin' alone?

4.) Do I need to copy the connect string info from when I first created the mysql database? If so, where do I copy and place the info? Does it go to a specific file?

5.) Lastly, when creating a mysql database, are they domain specific? It does not appear so. Even though I have more than one addon domain, the system does not ask which domain I would like to place the database. Where does it reside?

Thanks everyone. I appreciate everyone's help on this.

Mike

Reply With Quote
  #2  
Old 05-10-2006, 10:45 AM
chaloupe chaloupe is offline
King Croc
 
Join Date: Nov 2004
Location: Dieppe, New-Brunswick, Canada
Posts: 1,427
Default Re: Need Assistanc with Config.php, plus, a mysql question

Hi MikeinSC,

Quote:
Originally Posted by MikeinSC
1.) Do I change 'localhost' to my main domain name, or, leave it alone?
No you can leave it to 'localhost'. Localhost is 127.0.0.1 and your are on that machine so leave it as it is.


Quote:
Originally Posted by MikeinSC
2.) When I created the mysql database, it preceded the name with my username I use when logging into hostgator. Should I use that name, along with the name I gave the database when referring to the database? For example, 'username_mydatabasename', or, 'mydatabasename' ? Does this also apply to the user I created for the database? 'mydatabasename_databaseuser', or, would I use just 'databaseuser' to represent the assigned user to the database?
For $dbname = 'db_name'; You need to include the username of your hostgator account first than an underscore and the data base name you have created. An exemple is that you have MikeinSC for username at hostgator to log to your account and you have created a db call mambo.

the result should be
$dbname = 'MikeinSC_mambo';

You need to do the same thing with the user you have create the db also ->$dbuser = 'db_user'; should be something like ->$dbuser = 'MikeinSC_user-of-the-db';




Quote:
Originally Posted by MikeinSC
3.) Do I leave 'admin' alone?
As you wish but it should be better to leave it alone in case the program need to give privilige the the user that have the name admin. So just keep it and put a complicated password.


Quote:
Originally Posted by MikeinSC
4.) Do I need to copy the connect string info from when I first created the mysql database? If so, where do I copy and place the info? Does it go to a specific file?
Humm not following you here. Don't have any idea of what you are talking about.


Quote:
Originally Posted by MikeinSC
5.) Lastly, when creating a mysql database, are they domain specific? It does not appear so. Even though I have more than one addon domain, the system does not ask which domain I would like to place the database. Where does it reside?
They are your hosting account specific. So anybody using the account can use it but they need to have username and password to access to the db.

Best regards,
__________________
Jean Boudreau - IT for local businesses
It's all about automation!
Any data backup of your company?

Reply With Quote
  #3  
Old 05-10-2006, 10:59 AM
MikeinSC MikeinSC is offline
Hatchling Croc
 
Join Date: Apr 2006
Posts: 18
Default Re: Need Assistanc with Config.php, plus, a mysql question

Thanks Chaloupe. That info was very helpful.

The part I was speaking of regarding copying the connect string is as follows:

Connection StringsPerl$dbh = DBI->connect("DBI:mysql:mikeinsc_databasename:localhos t","mikeinsc_username","<PASSWORD HERE>");PHP$dbh=mysql_connect ("localhost", "mikeinsc_mypassword", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("mikeinsc_mydatabase");


This code appears directly in CPanel within the mysql area when you create the database. It is not explcit that the code has to be copied, but, I had read that somewhere. I did not know if this was the case or not?

Thanks.
Reply With Quote
  #4  
Old 05-11-2006, 04:10 PM
GatorDaveM
HostGator Guest
 
Posts: n/a
Default Re: Need Assistanc with Config.php, plus, a mysql question

Mike,

You don't necessarily have to copy it 100%: That code referenced is simply there as a guide.

You can use your own method/error strings if you choose!
Thank you for your time.
Reply With Quote
  #5  
Old 05-11-2006, 04:36 PM
Serra's Avatar
Serra Serra is offline
Veteran Croc
 
Join Date: Feb 2005
Location: Orange Park, FL
Posts: 5,073
Default Re: Need Assistanc with Config.php, plus, a mysql question

I don't use that string, it is just too hard to code. I break everything down into smaller chunks.
__________________
Six stages of Dedi Ownership

Fashionable broken link
image included
Reply With Quote
Reply

Bookmarks

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

All times are GMT -5. The time now is 06:04 PM.