EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 360+ Courses All in One Bundle
  • Login

MariaDB show users

Home » Data Science » Data Science Tutorials » Database Management Tutorial » MariaDB show users

MariaDB show users

Introduction to MariaDB show users

MariaDB Show Users is a MariaDB command which is responsible to show the list of all users present in a database server. The user records are saved in the user tables that include the usernames for login along with password having user privileges and other information too. You will find a system table as mysql.user in MariaDB as this is a split of MySQL so this system table will be available still as mysql.user for the compatibility issue. Hence, running a query against the mysql.user system table will return all of the Users which are created in the database MariaDB along with the information about these users.

Syntax

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

For MariaDB Show User command which is used for retrieving all users available in MariaDB, we will execute the succeeding query statement as syntax:

SELECT User FROM mysql.user;

Let us discuss the details of mysql.user MariaDB table comprising the columns explained below:

  • Host: User host that can be localhost, %, etc.
  • User: Name of the user such as admin, root, or any specific one, etc.
  • Password: It denotes the hashed value as password
  • Authentication_string: It denotes the security column.

Initially, to view the list of users in the MariaDB database, it is required to login into your admin account as an administrative level user through the mysql command-line client, that running this MySQL query:

SELECT * FROM mysql.user;

It should be noted that the above query will return and show the entire columns present in the mysql.user table that creates for a lot of result output. Thus, for the practical purpose it may be trimmed down few fields for displaying somewhat like this one below:

SELECT host, user, password FROM mysql.user;

How to show users in MariaDB using various ways?

  • In this MariaDB Show Users, initially login to your MariaDB/MySQL server using the mysql client as the root user, we will type the following query as:
  • $ mysql -u root –p, where p is for the password associated with this username or also can type: $ mysql –u root –h localhost –p mysql. After the user admin has logged in you can execute different SQL queries provided below to display the user accounts either in MySQL or MariaDB database server.
  • For the next step, you need to script the command at mysql>prompt for viewing the list items of user accounts available in the MariaDB database using the SELECT keyword and table mysql.user in the server as: SELECT User FROM mysql.user;
  • After this, one can further use some commands similar to previous one where it is allowed to logging for showing users together with their respective host name or password: SELECT host, user, password FROM mysql.user; or, SELECT host, user FROM mysql.user;
  • Again, for any repetition of database user names, we can avoid it by using the SQL code written as: SELECT User Distinct From mysql.user; where, the keyword as SELECT User DISTINCT in the query statement will result in generating the unique values.
  • You can even yield the list of column fields associated and selected from the MariaDB mysql.user table through the SQL query command as follows: DESC mysql.user
  • To discover the user rights granted we will implement the following command as: SELECT User, Db, Host From mysql.db;
  • Next, one can even find the privileges provided to a distinct MySQL user as: SHOW GRANTS for ‘username’@’localhost’;

Examples

In MariaDB, the server provisions information about the account users present in the database table which is defined as user available in the mysql database. Therefore, to fetch the names of all user accounts in MariaDB by applying the SELECT keyword statement that will retrieve all table rows from this mysql.user table in the server, which is typed as:

SELECT User FROM mysql.user;

On execution the output will be as follows:

Similarly, we can also fetch the host names associated with the users using the query command as,

Output:

MariaDB show users output 1

Again, run the query as:

SELECT User, Host FROM mysql.user;

Output:

MariaDB show users output 2

Now, as you can see that from the mysql.user server table the above command has retrieved just two table columns i.e. user and host, but more than 40 table columns are still available or contained by the mysql.user table such as password, update_priv, insert_priv, trigger_priv, select_priv, etc.

Generally, a user account in the MariaDB or MySQL server holds two sections where first is username and the second on is the hostname. A user can implement the command as DESC mysql.user; type statement to view the info about the database table columns. So, once the table column is known a user can execute the query against any specific data of the table.

For an instance, suppose we want to fetch the information of user accounts in MariaDB including the password for its status as lively or expired, then we will implement the following query statement:

SELECT User, Host, password_expired, Password FROM mysql.user;

Output:

MariaDB show users output 3

For retrieving information about users but associated to databases as the succeeding query will display data about all databases and related users:

SELECT User, host, db FROM mysql.db;

Output:

output 4

Here, the information of users those who have access to the level of databases privilege saved in the table defined as mysql.db will be viewed. Hence, with this we can discover the users who can manage a particular database with linked privileges. You can even use the WHERE clause to specify any database available in the server.

Also, you can yield list of all users from the table mysql.user in MariaDB with the query as follows with administrative privilege:

SELECT * FROM mysql.user;

Output:

output 5

Perhaps, this command will show entire table columns present in the table mysql.user but this makes the process of providing output a long execution thus, there may be need for trimming down few of the columns in practical implementation to view the users as required which can be achieved with the previous command statement as:

SELECT User, Host FROM mysql.user;

Using the below query you will fetch lists of table fields available in the mysql.user table:

DESC mysql.user;

Output:

output 6

Conclusion

  • Hence, MariaDB Show Users is MariaDB SQL command to draw the user accounts from table mysql.user or for the given MariaDB Database with privileges associated.
  • Using this MariaDB Show User query command one can view the users in MariaDB and also the permissions provided to each one.

Recommended Articles

This is a guide to MariaDB show users. Here we discuss How to show users in MariaDB using various ways along with the examples. You may also have a look at the following articles to learn more –

Popular Course in this category
Sale
SQL Training Program (7 Courses, 8+ Projects)7 Online Courses | 8 Hands-on Projects | 73+ Hours | Verifiable Certificate of Completion | Lifetime Access
4.5 (8,923 ratings)
Course Price

View Course

Related Courses
PL SQL Training (4 Courses, 2+ Projects)Oracle Training (14 Courses, 8+ Projects)
  1. MariaDB Timezone
  2. MariaDB Commands
  3. MariaDB Foreign Key
  4. MariaDB MaxScale

All in One Data Science Bundle (360+ Courses, 50+ projects)

360+ Online Courses

50+ projects

1500+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Database Management Tutorial
  • MariaDB
    • MariaDB Versions
    • MariaDB?list users
    • MariaDB Commands
    • MariaDB odbc
    • MariaDB Workbench
    • MariaDB for windows
    • MariaDB Server
    • MariaDB? Data Types
    • MariaDB?boolean
    • MariaDB phpMyAdmin
    • MariaDB Mysqldump
    • MariaDB Java Connector
    • MariaDB insert
    • MariaDB UPDATE
    • MariaDB? rename column
    • MariaDB AUTO_INCREMENT
    • MariaDB Timezone
    • MariaDB GROUP_CONCAT
    • MariaDB wait_timeout
    • MariaDB MaxScale
    • MariaDB? with
    • MariaDB? create?table
    • MariaDB? SHOW TABLES
    • MariaDB alter table
    • MariaDB List Tables
    • MariaDB JSON Functions
    • MariaDB Foreign Key
    • MariaDB? trigger
    • MariaDB Grant All Privileges
    • MariaDB Select Database
    • MariaDB? create database
    • MariaDB Delete Database
    • MariaDB List Databases
    • MariaDB Functions
    • MariaDB? TIMESTAMP
    • MariaDB create user
    • MariaDB add user
    • MariaDB show users
    • MariaDB Delete User
    • MariaDB? change user password
    • MariaDB? change root password
    • MariaDB reset root password
    • MariaDB IF
    • MariaDB bind-address
    • MariaDB Transaction
    • MariaDB Cluster
    • MariaDB Logs
    • MariaDB Encryption
    • MariaDB? backup
    • MariaDB Replication
    • MariaDB max_allowed_packet
    • MariaDB? performance tuning
    • MariaDB export database
    • MariaDB? import SQL
  • DataBase Management
    • Text Data Mining
    • Roles of Database Management System in Industry
    • SQL Server Database Management Tools
    • Database administrator skills
    • Database Management Systems Advantages
    • Database Testing Interview Questions
    • Data Administrator
    • Database Administrator
    • Database Management Software
    • DataStage
    • Types of Database Models
    • Types of Database
    • Hierarchical Database Model
    • Relational Database
    • Relational Database Advantages
    • Operational Database
    • What is RDBMS?
    • What is DB2?
    • Data Masking Tools
    • Database Security
    • Data Replication
    • Bitmap Indexing
    • Second Normal Form
    • Third Normal Form
    • Fourth Normal Form
    • Data Definition Language
    • Data Manipulation Language
    • Data Control Language
    • Transaction Control Language
    • Conceptual Data Model
    • Entity-Relationship Model
    • Relational Database Model
    • Sequential File Organization
    • Checkpoint in DBMS
    • Teradata Create Table
    • Centralized Database
    • Data Storage in Database
    • Thomas write Rule
    • DBA Interview Questions
    • What is JDBC?
    • jdbc hive
    • Apriori Algorithm
    • JDBC Architecture
    • JDBC Interview Questions
    • Wildcard Characters
    • Distributed Database System
    • Multidimensional Database
  • PL/SQL
    • What is PL/SQL?
    • Careers in PL/SQL
    • PLSQL procedure
    • PL/SQL Exception
    • PL/SQL LIKE
    • PL/SQL Raise Exception
    • PLSQL rowtype
    • PLSQL? bind variables
    • PL/SQL Record
    • PL/SQL WITH
    • PL/SQL bulk collect
    • PL/SQL Block Structure
    • PL/SQL else if
    • PL/SQL nvl2
    • PL/SQL Package
    • PL/SQL exists
    • PL/SQL instr
    • PL/SQL listagg
    • PL/ SQL Formatter
    • PLSQLlength
    • PL/SQL Commands
    • PL/SQL Data Types
    • CASE statement in PL/SQL
    • PL/SQL IF Statement
    • Loops in PL/SQL
    • PL/SQL Add Column
    • For Loop in PLSQL
    • PL/SQL Cursor Loop
    • PLSQL Array
    • Cursors in PL/SQL
    • PL/SQL FOR Loop Cursor
    • PL/SQL Queries
    • PL/SQL SELECT INTO
    • PL/SQL TO_CHAR
    • PL/SQL UNION
    • PL/SQL NOT EQUAL
    • PL/SQL varray
    • PL/SQL Concatenate
    • PL/SQL UPDATE
    • PL/SQL TRIM
    • PL/SQL GROUP BY
    • PL/SQL GOTO
    • PL/SQL Date Functions
    • PL/ SQL having
    • PL/SQL to_DATE
    • PL/SQL NVL
    • PLSQL format date
    • PLSQL mod
    • PLSQL round
    • PL/SQL Boolean
    • PL/SQL exit
    • PL/SQL DECODE
    • PL/SQL ROWNUM
    • PLSQL?pivot
    • PLSQL string functions
    • PL/SQL Block
    • PL/SQL Function
    • PL/SQL Unwrapper
    • PL/SQL Table
    • PL/SQL ALTER TABLE
    • PLSQL execute immediate
    • Triggers in PL/SQL
    • PL/SQL Collections
    • PL/SQL stored procedure
    • PL/SQL Anonymous Block
    • PLSQL Interview Questions
  • TSQL Basic
    • TSQL
    • What is T-SQL
    • T-SQL Commands
    • T-SQL String Functions
    • TSQL Interview Questions
  • SQLite
    • What is SQLite
    • SQLite Commands
    • SQLite Data Types
    • SQLite COUNT
    • SQLite Boolean
    • SQLite autoincrement
    • SQLite select
    • SQLite? Bulk Insert
    • SQLite? add column
    • SQLite? concat
    • SQLite BETWEEN
    • SQLite group by
    • SQLite CASE
    • SQLite group_concat
    • SQLite array
    • SQLite? enum
    • SQLite sum
    • SQLite create table
    • SQLite Alter Table
    • SQLite Create Database
    • SQLite Delete
    • SQLite connection string
    • SQLite Database
    • SQLite Describe Table
    • SQLite Show Tables
    • SQLite exit
    • SQLite create index
    • SQLite foreign key
    • SQLite Stored Procedures
    • SQLite Extension
  • DB2
    • DB2? current date
    • DB2 purescale
    • DB2 backup
    • DB2 restore
    • DB2 C Express
    • DB2 Version
    • DB2? Architecture
    • DB2? Data Types
    • DB2? load
    • DB2? order by
    • DB2 date
    • DB2 NVL
    • DB2? update
    • DB2 warehouse
    • DB2 grant
    • DB2 database
    • DB2 VARCHAR
    • DB2? INSERT
    • DB2 LISTAGG
    • DB2 LIKE
    • DB2 TRUNCATE TABLE
    • DB2 LIST TABLES
    • DB2 between
    • DB2? current timestamp
    • DB2? length
    • DB2? bind
    • DB2 limit rows
    • DB2? export
    • DB2 with
    • DB2 Create Table
    • DB2 case statement
    • DB2 CAST
    • DB2 Functions
    • DB2 Date Functions
    • DB2? row_number
    • DB2 trim
    • DB2? Translate
    • DB2 UNION
    • DB2 timestamp
    • DB2? TIMESTAMPDIFF
    • DB2? replace
    • DB2 merge
    • DB2 COALESCE
    • DB2 ISNULL
    • DB2? explain
    • DB2 Join
    • DB2 alter column
    • DB2 rename column
    • DB2? Describe Table
    • DB2? rename table
    • DB2 List Databases
    • DB2 LUW
    • DB2 Query
    • DB2 GROUP BY
    • DB2 TO_DATE
    • View Serializability in DBMS
    • MariaDB Join
    • MariaDB JSON
    • MariaDB? show databases
    • Dataset Normalization
    • MariaDB Max Connections
    • jdbc connection
    • MariaDB GUI
  • DBMS
    • Introduction To DBMS
    • DBMS ER Diagram
    • What is DBMS?
    • DBMS join
    • DBMS Functions
    • Data Administrator in DBMS
    • DBMS Canonical Cover
    • DBMS Log-Based Recovery
    • DBMS Multivalued Dependency
    • Netezza Database
    • DBMS Concepts
    • DBMS Constraints
    • DBMS_Scheduler
    • B+ Tree in DBMS
    • DBMS_LOB
    • dbms entity
    • DBMS Foreign Key
    • DBMS Users
    • DBMS_Metadata.get_ddl
    • Relational Algebra in DBMS
    • DBMS Components
    • DBMS Features
    • DBMS Models
    • DBMS Relational Model
    • Hashing in DBMS
    • DBMS network model
    • Relationship in DBMS
    • ER Model in DBMS
    • Data Models in DBMS
    • Static Hashing in DBMS
    • Advantages of DBMS
    • dbms_output.put_line
    • DBMS Data Dictionary
    • dbms_xplan.display_cursor
    • Normal Forms in DBMS
    • DBMS helps achieve
    • DBMS 3 tier Architecture
    • Relational Calculus in DBMS
    • Serializability in DBMS
    • File Organization in DBMS
    • DBMS Transaction Processing
    • States of Transaction in DBMS
    • Functional Dependency in DBMS
    • Generalization in DBMS
    • Data Independence in DBMS
    • Lock Based Protocols in DBMS
    • Deadlock in DBMS
    • Integrity Constraints in DBMS
    • Concurrency Control in DBMS
    • Validation Based Protocol in DBMS
    • DBMS Locks
    • Normalization in DBMS
    • Transaction Property in DBMS
    • Specialization in DBMS
    • Aggregation in DBMS
    • Types of DBMS

Related Courses

SQL Certification Course

PL/SQL Certification Course

Oracle Certification Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Live Classes
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Database Management
  • Machine Learning
  • All Tutorials
Certification Courses
  • All Courses
  • Data Science Course - All in One Bundle
  • Machine Learning Course
  • Hadoop Certification Training
  • Cloud Computing Training Course
  • R Programming Course
  • AWS Training Course
  • SAS Training Course

© 2022 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

EDUCBA
Free Data Science Course

Hadoop, Data Science, Statistics & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Let’s Get Started

By signing up, you agree to our Terms of Use and Privacy Policy.

Loading . . .
Quiz
Question:

Answer:

Quiz Result
Total QuestionsCorrect AnswersWrong AnswersPercentage

Explore 1000+ varieties of Mock tests View more

EDUCBA Login

Forgot Password?

By signing up, you agree to our Terms of Use and Privacy Policy.

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you

By signing up, you agree to our Terms of Use and Privacy Policy.

Special Offer - SQL Certification Course Learn More