HomeLinuxMethods to Checklist the Customers in a MySQL Database

Methods to Checklist the Customers in a MySQL Database


MySQL server is commonly the primary selection for customers who wish to work with SQL (structured question language). It has a number of superior options that make it safer, dependable, and environment friendly. More often than not, it’s wanted to handle a database on a MySQL server. In that case, verify the person accounts listing. Extra particularly, a number of instructions and statements can be utilized for this function.

The outcomes of this publish are:

Technique 1: Methods to Checklist the Present Customers in a MySQL Database?

To get the listing of all present customers in a MySQL database, supplied steps ought to be adopted.

Step 1: Launch “Command Immediate”

At first, open the “Command Immediate” terminal with the assistance of the Startup menu:

Step 2: Entry MySQL Server

Now, entry the MySQL server by using the given command together with the username and person password:

Step 3: Show Databases

Subsequent, use the “SHOW” command with the “DATABASES” choice to view all current databases:

From the below-given output, we’ve chosen the “mysql” database:

Step 4: Change Database

Now, change the present database by working the “USE” command and specify the database identify as follows:

Step 5: Checklist Present Customers

To get the details about all present customers, the “person()” operate may be invoked with the “SELECT” assertion:

As you may see, presently, we’ve a “root@localhost” person:

We are able to additionally use the “current_user()” operate for viewing the present username:

Technique 2: Methods to Checklist the Present Logged MySQL Database Customers?

Generally, that you must view solely the presently logged customers in a MySQL database. For this function, make the most of the “SELECT” command:

SELECT person,host, command FROM information_schema.processlist;

Right here:

  • SELECT” command is utilized to pick the variable’s worth.
  • person” possibility will get all customers’ names.
  • host” possibility denotes the hostname.
  • command” represents one person executing a question and one other within the “Daemon” state.
  • FROM” clause is used for choosing some data from a desk.
  • Information_schema.processlist” is the MySQL course of listing that represents what course of is presently being carried out by the set of data:

Technique 3: Methods to Checklist the Customers With Account Locked and Password Element in a MySQL Database?

To get the listing of the customers with their account and password particulars in a MySQL database, the next command can be utilized:

SELECT person,host, account_locked, password_expired FROM person;

Within the above-stated command:

  • account_locked” possibility is used to signify the customers’ account state whether or not it’s locked or not.
  • password_expired” possibility denotes whether or not the person’s account password has expired or not.

As you may see within the below-provided output, all data has been displayed:

Now we have compiled a number of methods to get the listing of customers in a MySQL database.

Conclusion

To get the customers in a MySQL database, there are a number of methods in response to the customers, reminiscent of if the person needs to only get the present customers listing, then the “SHOW person()” or “SHOW current_user()” statements can be utilized. Then again, whether it is required to get the data together with the person, hostname, command, account, and password, the “SELECT” assertion may be utilized. This publish described a number of methods to get the listing of customers in a MySQL database.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments