LexiConn Knowledgebase

Knowledgebase Home | Favorites Knowledgebase Home | Favorites
Search the Knowledgebase Browse by Category
How do I connect to my MySQL database with PHP?
Article Details

Last Updated
17th of June, 2008

User Opinions (7 votes)
71% thumbs up 28% thumbs down

How would you rate this answer?
Not helpful

Here is a quick description of what commands are needed in your PHP pages to connect to MySQL. Note that if you need to connect remotely from another machine, you must let us know the IP# you will be connecting from so we can enable this for your database.

1. Connect to the MySQL Server

Use the following statement to connect to the database server. Substitute the username and password for your MySQL username and password.


2. Select Your Database

Use the following statement to select the database you wish to connect to. Make sure you substitute your database name for the example.


3. Executing A Query

You are now ready to execute your queries. (Most problems that arise with your scripts will be due to incorrect permission settings.)

Related Articles
No attachments were found.

Powered by Interspire Knowledge Manager Knowledgebase Software