Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mysql.user table on mySQL

I use mySQL on Mac OS. I login mySQL by the command

mysql - u root

then run the command below

select User from mysql.user;

It show the table below

+---------+
| User    |
+---------+
| root    |
| root    |
|         |
| root    |
|         |
| gerrit2 |
| root    |
+---------+
7 rows in set (0.08 sec)

I don't understand that there're 4 rows has root and 2 rows has no name. Please explain me. Thank you!

like image 338
vietstone Avatar asked Feb 14 '12 13:02

vietstone


People also ask

How do I find the user table in MySQL?

To show the users in a MySQL database, first log into your MySQL server as an administrative user using the mysql command line client, then run this MySQL query: mysql> select * from mysql. user; However, note that this query shows all of the columns from the mysql.

Does MySQL have user interface?

MySQL Shell is an interactive interface to MySQL supporting JavaScript, Python, or SQL modes. You can use MySQL Shell to prototype applications, execute queries and update data.

How do I connect to a MySQL user?

Enter mysql.exe -uroot -p , and MySQL will launch using the root user. MySQL will prompt you for your password. Enter the password from the user account you specified with the –u tag, and you'll connect to the MySQL server.

What is user table?

USER_TABLES describes the relational tables owned by the current user. Its columns (except for OWNER ) are the same as those in ALL_TABLES . To gather statistics for this view, use the ANALYZE SQL statement.


1 Answers

The row-defining part in mysql.users is the (host,user) tuple - this means:

  • You can have permissions without a username, depending on which host you connect from
  • You can have different permissions with the same username, again depending on the host
like image 144
Eugen Rieck Avatar answered Oct 16 '22 03:10

Eugen Rieck