MySQL – Basic User Information

Background

Once one is connected to MySQL, it is good to review basic user information.

Functions

Here are some available functions for reviewing one’s own information.

Outline

  1. username
    • user()
    • current_user
  2. Review Permissions
    • show grants

Username

There are a few functions that basically do the same thing.

They are all return the current user’s name.

The functions are :-

  1. user()
  2. current_user

SQL

Sample


select
	  user() as 'user()'
	, current_user as 'current_user'

Output

userProfile.user.01.20190714.0812AM

 

Permissions

Let us quickly see what permissions we have.

There are functions for introspectively reviewing one own’s permission :-

  1. show grants
    • Show Grants ( for yourself )
    • Show Grants ( for another user )

Show Grants

Show Grants for Self

SQL
Sample

SHOW GRANTS

Output

showGrants.01.20190714.0817AM.PNG

Show Grants for Others

SQL
Sample

SHOW GRANTS for '{me}'@'%'

Output

showGrants.01.20190714.0817AM.PNG

 

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s