How to execute Mysql query and select list of users without phpMyAdmin in Ubuntu?

How to execute Mysql query and select list of users without phpMyAdmin in Ubuntu?

To execute Mysql query in Ubuntu you must have root access credentials.

Connect your server or cloud (If it is on another server) with Putty and then execute the following command.( You may required login details)

$ sudo mysql -u root # I had to use “sudo” since is new installation

This will display output something like this

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 5.7.25-0ubuntu0.18.04.2 (Ubuntu)

Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

Then select the database and execute the query:

mysql> USE mysql;

mysql> SELECT User, Host, plugin FROM mysql.user;
+—————————+—————+————————————–+
| User | Host | plugin |
+—————————+—————-+————————————-+
| root | localhost | auth_socket |
| mysql.session | localhost | mysql_native_password |
| mysql.sys | localhost | mysql_native_password |
| debian-sys-maint | localhost | mysql_native_password |
+—————————+—————-+————————————-+
4 rows in set (0.00 sec)