Configuring mysql.php file
Moderator: General Moderators
Configuring mysql.php file
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?
$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?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Configuring mysql.php file
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)
Re: Configuring mysql.php file
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.
I thought this would be easier.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Configuring mysql.php file
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.
Re: Configuring mysql.php file
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
What kind of webhotel or server do you want to put your stuff on?
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Configuring mysql.php file
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.
Re: Configuring mysql.php file
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?
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: Configuring mysql.php file
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.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?
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.
Re: Configuring mysql.php file
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?
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?