Creating a Database using phpMyAdmin and Command Line

Prior to setting up your uKnowva database, it is essential that you have a ready, created database that you can connect. This article outlines the steps involved in creating a database using phpMyAdmin and Command Line.

Creating a Database using phpMyAdmin:

  1. Log in to your instance of phpMyAdmin
  2. In the landing page, you will see an option to create a new database. Enter the name that you would like to give your database and click Create. Once the database is created, it will be displayed in the list on the left side.

  3. Once you database is created, click on the name in the left side and then click on the Privileges tab.

  4. In this tab, click on Add a New User.

  5. Enter the Username, Password and Host for the new user.

  6. When you scroll down the page you will see options for granting privileges to the user. Here, you can provide either all privileges or limited privileges to the user. 
    • To provide all privileges, select “Grant all privileges on database “db_name”,” click “Check All” and then click “Go.”
    • To provide limited privileges, select “Grant all privileges on database “db_name”,” select the boxes that you need to and then click “Go.”

Creating a Database using Command Line:

  1. Log in to MySOL using the following commands:
    user@server:~$ mysql -u mysql_user -p
    Enter password:
  2. Now you can create your database by typing the following command:
    mysql > create database db_name;
  3. To verify that your table has been created, use the following command:
    mysql > show databases;
  4. Next, you create a new user:
    mysql > create user db_user;
  5. You can grant privileges to the user when assigning the password for this account.
    • The following command provides all privileges to the user:
      mysql > grant all on db_name.* to 'db_user'@'localhost' identified by 'db_password';
    • To provide limited privileges, choose the privileges that apply and separate by comma, as shown:
      mysql > grant select, insert, delete on db_name.* to 'db_user'@'localhost' identified by 'db_password';
Was this Article helpful?