Print Current Login User Information

Beginner

In this project, you will learn how to access the MySQL database and obtain information about the current logged-in user and the system user.

SQLMySQL

Introduction

In this project, you will learn how to access the MySQL database and obtain information about the current logged-in user and the system user.

👀 Preview

MariaDB [(none)]> SOURCE /home/labex/project/currentUser.sql;
+----------------+----------------+
| CURRENT_USER() | SYSTEM_USER()  |
+----------------+----------------+
| root@localhost | root@localhost |
+----------------+----------------+
1 row in set (0.000 sec)

🎯 Tasks

In this project, you will learn:

  • How to access the MySQL database using the sudo command without a password
  • How to use the CURRENT_USER and SYSTEM_USER functions to retrieve user information
  • How to save the SQL script to a designated file location

🏆 Achievements

After completing this project, you will be able to:

  • Understand how to access the MySQL database and execute SQL statements
  • Retrieve information about the current logged-in user and the system user
  • Save SQL scripts to a specific file location for future use

Teacher

labby

Labby

Labby is the LabEx teacher.