How To Connect The Database To The Site

Table of contents:

How To Connect The Database To The Site
How To Connect The Database To The Site

Video: How To Connect The Database To The Site

Video: How To Connect The Database To The Site
Video: How to Connect HTML Form with MySQL Database using PHP 2024, April
Anonim

In order for the site to work actively and save all data about users or simply store the material, you need to connect special databases. Not every person copes with the task at hand, because they have no idea about it. However, everything is decided in a matter of minutes.

How to connect the database to the site
How to connect the database to the site

It is necessary

  • - Personal Computer;
  • - the Internet;
  • - website

Instructions

Step 1

Create the actual database that you will connect to the site. Go to the section "Control Panel", which is located on the site. Select the "Database" section. Create a new document. After this operation, the resulting database will look like this: account_The name of the database. You also need to create a username. Now connect the script to the resulting database. Find the file that contains the connection parameters. It is usually named config.php.

Step 2

Edit the config file. This can be done on a personal computer by going through the "Start" to the "Notepad" program. Write down all the connection parameters:

1) $ hostName = "localhost"; // localhost is the hostname

2) $ userName = "account_UserName"; // base username

3) $ password = "*****"; // user password

4) $ databaseName = "account_DatabaseName"; // database name.

Then transfer all data to the hosting.

Step 3

You can also make the database connection in a different way. Go to the "Control Panel" on the hosting you need. In the menu, find and click on the "MySQL User Management" section. Then click on the "Add" button. Thus, you have created a username and password. Click Next. Go to the section "MySQL Database Management". Click on the "Add" button. Enter the name "Admin" in the description. Click on the "Add" button again. Remember your database name and password. Click Next. A window will open in which you need to make some settings. Add your DB username. On the hosting, create a database directory. Make entries in the created folder. This file will be named connect.php. It includes connection settings. If necessary, fill in all the necessary items using the user data.

Recommended: