Time for action—creating a MySQL database and user

This step is needed for OpenCart to connect and store all the data in a MySQL database. We will learn how to create a new database and user for this database. We will later use this information in OpenCart Installation wizard.

We will use MySQL Databases link on cPanel. Even though there can be slight differences on different cPanel versions, the main idea and the process is the same.

  1. Click on MySQL Databases link on cPanel:
    Time for action—creating a MySQL database and user
  2. Enter a name for the database. Here, we named the database as opencart. Then, click on the Create Database button.
    Time for action—creating a MySQL database and user

    If we are on a share hosting, a prefix will be added automatically to the name we provided. This is generally the username which we use to log in to the cPanel. So, your database name will follow the template of cPanelLogin_databasename.

    Time for action—creating a MySQL database and user

    Take a note of the database name including the prefix.

  3. Now, let's create a user and assign this user to our newly created database. We go back from database creation result page and jump to MySQL Users section.

    Choose a username and password. Repeat the password on the last text box and be sure that the password is not very easy to guess for security preferably a mixture of letters and numbers.) We have chosen dbuser as the username. Click on the Create User button after filling all the required textboxes.

    Time for action—creating a MySQL database and user

    Please note that a prefix will be added to the user as well. Take a note of the username.

  4. We need to add user to the database as the last step. Choose the newly created user and database for OpenCart, and then click the Add button.
    Time for action—creating a MySQL database and user
  5. In this step, we are going to assign privileges for the user in the database. Select the All Privileges option, and then press the Make Changes button to give all the privileges to the user.

    Tip

    Providing all MySQL privileges to a user can be dangerous on a production site. Optionally, you can remove unnecessary permissions such as create, drop, and alter tables after installation is complete. Also note that some plugins which we can later install can require create, and alter permissions.

    Depending on our knowledge and experience on MySQL permissions, we are free to choose an advanced or simplified privileges management.

    Time for action—creating a MySQL database and user

    The following screenshot shows the result page after clicking the Make Changes button:

    Time for action—creating a MySQL database and user

What just happened?

We have seen how to prepare a database for OpenCart. The steps include:

  1. Choosing a name for the database.
  2. Choosing a username and providing a secure password.
  3. Adding user to the database.
  4. Adding privileges to user for the database.

Now we are ready to continue our installation by using OpenCart Installation Wizard.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.47.25