On this quick and easy tutorial, I’m going to indicate you methods to present all of the customers in a MySQL/MariaDB database.
There are a lot of SHOW instructions in MySQL: SHOW DATABASES, SHOW TABLES, SHOW VARIABLES, and so on. Naturally, individuals anticipate there to be a SHOW USERS command. Nevertheless, there’s no “SHOW USERS” in MySQL. There’s a unique technique to displaying/itemizing all of the customers in a database in MySQL.
I’ve questioned why there’s no SHOW USERS command, I even tried operating SHOW USERS; in my early days. The precise command to indicate all of the customers in MySQL remains to be fairly easy and straightforward to recollect.
Learn how to SHOW USERS in a MySQL database
It’s fairly easy, the command you’ll want to run to “SHOW USERS” in MySQL is:
SELECT Person FROM mysql.person;
This command exhibits you the usernames from the customers desk in your MySQL database. Instance outcomes:
Person debian-sys-maint mysql.infoschema mysql.session mysql.sys root
If you wish to present all the information within the Person desk, run the next command:
SELECT * FROM mysql.person;
These are the two most typical instructions for displaying all customers in MySQL.
There are different comparable instructions that will enable you to. I’ll clarify them under.
Learn how to present the present customers in MySQL
To point out the present person (the one you’re logged in with), run:
SELECT person();
To point out all of the at the moment logged in customers, run:
SELECT Person FROM information_schema.processlist;
That’s just about it for this tutorial meant for learners. Brief and easy.