Configuring mysql.php file

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
easinewe
Forum Newbie
Posts: 23
Joined: Mon Jan 11, 2010 3:22 pm

Configuring mysql.php file

Post 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?
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Configuring mysql.php file

Post 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.
(#10850)
easinewe
Forum Newbie
Posts: 23
Joined: Mon Jan 11, 2010 3:22 pm

Re: Configuring mysql.php file

Post 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:
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Configuring mysql.php file

Post 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?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
easinewe
Forum Newbie
Posts: 23
Joined: Mon Jan 11, 2010 3:22 pm

Re: Configuring mysql.php file

Post 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?
Marbled-D
Forum Newbie
Posts: 8
Joined: Sat Jan 23, 2010 5:39 pm

Re: Configuring mysql.php file

Post by Marbled-D »

What kind of webhotel or server do you want to put your stuff on?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Configuring mysql.php file

Post 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?
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
easinewe
Forum Newbie
Posts: 23
Joined: Mon Jan 11, 2010 3:22 pm

Re: Configuring mysql.php file

Post 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?
User avatar
AbraCadaver
DevNet Master
Posts: 2572
Joined: Mon Feb 24, 2003 10:12 am
Location: The Republic of Texas
Contact:

Re: Configuring mysql.php file

Post 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.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
easinewe
Forum Newbie
Posts: 23
Joined: Mon Jan 11, 2010 3:22 pm

Re: Configuring mysql.php file

Post 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?
Post Reply