PHP

Working with phpMyAdmin – Creating Users and Assigning Privileges

In this article on Working with phpMyAdmin – Creating Users and Assigning Privileges, I will explain how to create a user for a database and how to assign privileges to that user.

Also developed in PHP, phpMyAdmin is a tool that allows the users to manage MySQL database. Basically, it is a free software tool and provides many features that make managing the database operations easier. For instance, you can create database, tables, indexes, constraints and other operations. Otherwise you need to perform these operations with SQL commands. Moreover, you can write and execute the SQL commands in the SQL editor that is available in this tool.

Demonstration of Working with phpMyAdmin – Creating Users and Assigning Privileges

At first, start the Wampserver and click on the phpMyAdmin.

Starting phpMyAdmin
Starting phpMyAdmin

As a result, we get the following interface that contains the options to perform different tasks on the database. As can be seen below, on the left pane, there is a list of existing databases.

An Example of Working with phpMyAdmin - Creating Users and Assigning Privileges
An Example of Working with phpMyAdmin – Creating Users and Assigning Privileges

In order to create a database, click on the Database option. So, you get the list of existing databases as well as provision to create a new database.

View Databases in phpMyAdmin
View Databases in phpMyAdmin

After that enter the name of the database and click on the Create button.

Create a Database in phpMyAdmin
Create a Database in phpMyAdmin

In order to create the database users, click on the Privileges option.

Select Privileges Tab in phpMyAdmin
Select Privileges Tab in phpMyAdmin

After that, click on the Add user account.

Creating a User in phpMyAdmin
Creating a User in phpMyAdmin

Now enter the username and password and check on the option for granting all privileges.

Granting Privileges
Granting Privileges

Also, click on the Check All button. It will assign the global privileges.

Grant All Privileges to a phpMyAdmin User
Grant All Privileges to a phpMyAdmin User

Furthermore, you can also set the option for accessing the database using SSL. For now, leave it as default option of REQUIRE NONE.

SSL Options in phpMyAdmin
SSL Options in phpMyAdmin

After That, click on the Go button. It will execute the Create User SQL command.

Create User Command
Create User Command

Again click on the Databases tab. You will find the name of your newly created database in the list. In order to find the database user and privileges, click on the Check privileges link.

Database Created
Database Created

As can be seen below, the database mydb has two users mydb_user and root. Both of these users have all privileges.

Users and Privileges for a Database Shown in phpMyAdmin
Users and Privileges for a Database Shown in phpMyAdmin


Further Reading

Examples of Array Functions in PHP

Basic Programs in PHP

Registration Form Using PDO in PHP

Inserting Information from Multiple CheckBox Selection in a Database Table in PHP

PHP Projects for Undergraduate Students

Architectural Constraints of REST API

REST API Concepts

Creating a Classified Ads Application in PHP

programmingempire

princites.com

Meta Tag Manager

You may also like...

Leave a Reply

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