Search⌘ K
AI Features

Exercise: User Management and Access Control

Explore practical exercises to create and manage users in MySQL, assign specific privileges, revoke access, and enforce password expiration policies. This lesson helps you build essential skills in user management and access control for secure database administration.

Now it’s time to get some hands-on practice!

Question 1

For our OnlineStore, create a user named inventory_clerk who can only connect from IP addresses in the 10.10.20.x subnet. Assign the password Inv3ntoryCl3rk!.

MySQL 8.0
-- Create an inventory_clerk user restricted to the 10.10.20.x subnet

If you’re stuck, click the “Show Solution” button.

Question 2

Given the following structure of the Products table:

Field

Type

ProductID

int

ProductName

varchar(50)

CategoryID

int

Price

decimal(10,2)

Stock

int

LastRestockDate

date

MonthlySales

int

InventoryTurnoverRate

decimal(5,2)

Where ProductID is the primary key and CategoryID is the foreign key from the  ...