• Abigail November 8, 2017
    How-to-create-database-connection-in-wordpress

    This article helps you to understand How to create database connection in wordpress.
    This article consists of following topics:

    • Why I need so?
    • How can do it myself without impacting websites?
    • Difficulty level [Easy, Medium, Hard].
    • Total time consumed.

    Why i need to do so?

    If you choose to host WordPress by yourself and install the wordpress manually. you have to create a mysql database for wordpress and edit its configuration file wp-config.php. It is because WordPress require a database and a valid connection string between web server and database server.  if you do not establishing a connection between wordpress and database you cant get information , content, data etc about your site and can not visit your site or make a live.

    To create database connection follow the steps:

    Create a database:

     1: Go to your cPanal and Login

     

    Cpanal Login

    After Login cPanal open cPanal window look like:

    2: Go to DATABASE Section and click on MySQL Database
    Cpanal
    3: Create New Database
    Step1:  Write Database Name(my_db1)
    Step2: Click on Create Database
    Create new database
    Then get a message (added the database).Click on Go Back.
    Successful message
    4: Add New User:
    Step1: Write Username(anju)
    Step2: Type Password
    Step3: Retype Password
    Step4: Click on Create User
    Add New user in database
    Now you get a message(Successfully created a MySQL user).Click on Go Back.
    Successful message
    5: Add User to Database
    Step1: Select user by drop-down menu
    Step2: Select database by drop-down menu
    Step3: Click on Add
    Add user to database
    After that Manage User Privileges
    Step1: Check the box All Privileges
    Step2: Click on Make Changes
    Manage user privlleges
    You get a message(requested privileges on the database).Click on Go Back
    Successful message
    Now you can see your database and user create successfully.
    Current Databases
    Current users
    Create a connection with database:

    Step1: Go to files and click on File Manager

    File manager in cpanal
    Edit database login settings in wp-config:
    Step1: Click on your website folder
    Step2: right click on wp-config.php file

    wp files
    Step3: Click on code edit

    Edit Config file

    Edit wp-config.php file

    Step1: check your details
    As you can see, there are four  information WordPress needs to access your database:

    1. The name of the database (“DB_NAME”)
    2. The login username (“DB_USER”)
    3. The login password (“DB_PASSWORD”)
    4. The database host (“DB_HOST”)

    Step2: If there is any error then correct the information
    Step3: Click on save change

    Config File
    Refresh your browser , and your website running normally.

    C: Difficulty Level {Easy, Medium, High}

    High

    D: Total Time Consumed

    45 Minutes

    E: Related Plugins or WorkAround

    No
    Summary
    How to create database connection in wordpress?
    Article Name
    How to create database connection in wordpress?
    Description
    If you choose to host WordPress by yourself and install the wordpress manually. you have to create a mysql database for wordpress and edit its configuration file wp-config.php. It is because WordPress require a database and a valid connection string between web server and database server.  if you do not establishing a connection between wordpress and database you cant get information , content, data etc about your site and can not visit your site or make a live.
    Author
    Publisher Name
    WordPress Support
    Publisher Logo

    Leave a comment.

    Your email address will not be published. Required fields are marked*

    error: Content is protected !!