Featured resource
2025 Tech Upskilling Playbook
Tech Upskilling Playbook

Build future-ready tech teams and hit key business milestones with seven proven plays from industry leaders.

Check it out
  • Lab
    • Libraries: If you want this lab, consider one of these libraries.
    • Cloud
Google Cloud Platform icon
Labs

Creating Users and Managing Privileges in MySQL

The ability to create users and manage privileges provides a granular level of security and access in MySQL. In this lab, you will be tasked with creating new users in the MySQL server and deleting users that no longer need access. Once the users are created, you will need to grant the appropriate privileges to each user so that they have access to the correct databases and tables within the server.

Google Cloud Platform icon
Lab platform
Lab Info
Level
Intermediate
Last updated
Jun 27, 2025
Duration
1h 0m

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.
Table of Contents
  1. Challenge

    Create the Following Four Users on the MySQL Server: `corey`, `will`, `mike`, and `myles`, and Allow Logins from `localhost` Only, Using the Password `Linux4you!`

    Once logged in to the MySQL server, run the following command to create the users:

    mysql> CREATE USER 'corey'@'localhost' IDENTIFIED BY 'Linux4you!','will'@'localhost' IDENTIFIED BY 'Linux4you!','mike'@'localhost' IDENTIFIED BY 'Linux4you!','myles'@'localhost' IDENTIFIED BY 'Linux4you!';

  2. Challenge

    Delete the User `stosh` from the MySQL Server

    Delete the user stosh using the DROP statement:

    mysql>DROP USER 'stosh'@'localhost';

  3. Challenge

    Grant Privileges on the Newly Created Users According to the Information Provided in the Instructions

    Grant all privileges on the dev database to the corey user:

    mysql> GRANT ALL ON dev.* TO 'corey'@'localhost';

    Grant INSERT and SELECT privileges on the products table in the dev database to will:

    mysql> GRANT SELECT, INSERT ON dev.products TO 'will'@'localhost';

    Grant ALL privileges on the prod database to the mike user:

    mysql> GRANT ALL ON prod.* TO 'mike'@'localhost';

    Grant SELECT privileges on the products table in the prod database to myles user:

    mysql> GRANT SELECT ON prod.products TO 'myles'@'localhost';

  4. Challenge

    Revoke the INSERT Privilege from the `kenny` User on the `orders` Table in the `prod` Database

    Revoke the INSERT privilege from the kenny user running the following command:

    mysql> REVOKE INSERT ON prod.orders FROM 'kenny'@'localhost';

  5. Challenge

    Optionally, Validate the Updated Privileges by Testing User Access

    Ensure that the user corey does not have access to the prod database. Run the following as the corey user:

    mysql> SELECT * FROM prod.orders;

    Ensure that the user will does not have access to the orders table on the dev database. Run the following as the will user:

    mysql> SELECT * FROM dev.orders;

    Ensure that the user mike does not have access to the dev database. Run the following as the mike user:

    mysql> SELECT * FROM dev.orders;

    Ensure that the user myles does not have access to the orders table in the prod database. Run the following as the myles user:

    mysql> SELECT * FROM prod.orders;

    Ensure that the user kenny does not have INSERT privileges on the orders table in the prod database. Run the following as the kenny user:

    mysql> INSERT INTO prod.orders (orderID,userName,orderType,purchaseDate) VALUES (4,'mike','laptop','2018-04-08');

About the author

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

Real skill practice before real-world application

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Learn by doing

Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.

Follow your guide

All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.

Turn time into mastery

On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.

Get started with Pluralsight