|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||||
|
|||||
|
Hi MikeinSC,
Quote:
Quote:
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:
Quote:
Quote:
Best regards,
|
|
#3
|
|||
|
|||
|
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. |
|
#4
|
|||
|
|||
|
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. |
|
#5
|
||||
|
||||
|
I don't use that string, it is just too hard to code. I break everything down into smaller chunks.
|
![]() |
| Bookmarks |
«
Previous Thread
|
Next Thread
»
| Thread Tools | |
|
|
All times are GMT -5. The time now is 06:04 PM.










