Page 1 of 1

Configuring mysql.php file

Posted: Fri Jan 22, 2010 10:29 pm
by easinewe
I have finished my php site and it is working nicely working locally. Now I want to upload it to the server and test it online however I'm a bit confused as to how I need to configure mysql.php file. I know that I need to change the following information in that file...

$hostname = "localhost";
$username = "root";
$password = "root";
$database = "Catalog.sql";


but where am I supposed to get the information for the first 3 variables. Does the person who runs our server have this information or do I determine it? When I try to access the php site online it says "can't connect to database."

Sorry if this is a stupid question but I can't find a straight answer for it.

Any help?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 2:45 am
by Christopher
Yes, you need to get the name of the database, plus a username and password to connect to that database. Most hosting plans have something like phpMyAdmin available to manage tables and data.

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 3:28 pm
by easinewe
Okay, just got the codes I needed. I have changed the mysql.php file but I'm still not getting the database information. Do I have to export my database files and put them in a special folder? Should I be looking for somewhere specific to put the database files.

I thought this would be easier. :banghead:

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 4:41 pm
by AbraCadaver
Have you created a database? I would assume Catalog.sql to be a SQL file. You would need to import this into a database. With out knowing what tools you have to create/manipulate a database, I can't say more. As aborint suggested, do you have phpMyAdmin or another database tool in your control panel?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 5:45 pm
by easinewe
Locally I have a database called "Catalog" with 3 tables in it. The person who has set up the server has specified a database name of "catalog_DB1". How do I import into the online database?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 6:00 pm
by Marbled-D
What kind of webhotel or server do you want to put your stuff on?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 6:23 pm
by AbraCadaver
AbraCadaver wrote:Have you created a database? I would assume Catalog.sql to be a SQL file. You would need to import this into a database. With out knowing what tools you have to create/manipulate a database, I can't say more. As aborint suggested, do you have phpMyAdmin or another database tool in your control panel?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 8:27 pm
by easinewe
I'm using MAMP to create my database which has phpMyAdmin. Will that assist me in properly uploading to the server? Is that the control panel you are referring to? I also see a folder on my server called .cpanel do I need to do something with that?

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 10:06 pm
by AbraCadaver
easinewe wrote:I'm using MAMP to create my database which has phpMyAdmin. Will that assist me in properly uploading to the server? Is that the control panel you are referring to? I also see a folder on my server called .cpanel do I need to do something with that?
You said someone setup a database 'catalog_DB1' on a server. That's where you need a tool or command line access to import your sql file into the 'catalog_DB1' database.

Re: Configuring mysql.php file

Posted: Sat Jan 23, 2010 10:46 pm
by easinewe
Should the person who set up the server be giving me instruction on how to do this? Seems like I should just be able to see a file called "catalog_DB1" on my server and replace the contents of it. But that is not the case.

Alternately could I just make a database in phpMyAdmin called catalog_DB1 and import the necessary tables into it. Then somehow export that database and post it on my server?