Global - Documentation

Learn how to create a database using phpMyAdmin on your localhost. This step-by-step tutorial will guide you through the process, ensuring you set up your database efficiently for various web development projects.

  1. Access phpMyAdmin
    1. Open your web browser and navigate to http://localhost/phpmyadmin/.
    2. Log in with your phpMyAdmin credentials.
  2. Navigate to the Databases Tab and create a Database
    1. Once logged in, click on the Databases tab located in the top menu.
    2. Type a database name, for example, myshopdatabase. Copy and save the database name in your Notepad/TextEdit for later use.
    3. Choose a suitable collation from the dropdown menu.
    4. Click on the Create button.
    5. You will see a confirmation message indicating that the database has been created successfully.
  3. Create and assign a new user to this database:
    While in localhost, you can use your root username and password for this database. However, if you need to create and assign a new user to this database, follow these steps:
    1. Return to the phpMyAdmin homepage by clicking the home icon beneath the phpMyAdmin logo.
    2. Click on the User accounts tab located in the top menu.
    3. Click on the Add user account located under the New section.
    4. Enter the necessary information for the new MySQL/MariaDB user, including:

      1. User name: Enter a username without spaces and special characters, and use lowercase to avoid potential issues later on. For example: myshopuser. Copy and save the user name in your Notepad/TextEdit for later use.
      2. Host name: Choose Local if you do not require connection to this database from an external network or server.
      3. Password: Enter a new password. Copy and save the password in your Notepad/TextEdit for later use.
      4. Re-type: Re-type your new password.
      5. Leave other options as they are (unselected).
      6. Click on the Go button.
    5. Assign the user with the database:
      1. Click on the User accounts tab located in the top menu.
      2. Click on the Edit Privileges under the user (myshopuser).
      3. Click on the Database tab, as illustrated in the following picture:
      4. Select the database, for example, myshopdatabase.
      5. Click on the Go button.
      6. Click on Check all next to the Database-specific privileges, as illustrated in the following picture:
      7. Click on Go button.


Congratulations! You have successfully created a database, a new user, and assigned the user to the database using phpMyAdmin on your localhost.