Clarification required for user account used to connect to MySQL.
Hello everyone,
I have started using MySQL around a month back.
I was referring to the chapter at the following link to understand how & which user/host combination is resolved & gets connected to a MySQL instance:
http://dev.mysql.com/doc/refman/5.5/en/connection-access.html
The following is the list of users in my local MySQL:
mysql> SELECT host, user FROM user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | |
| % | root |
| % | sachin |
| localhost | |
| localhost | root |
| localhost | sachin |
+-----------+---------------+
10 rows in set (0.01 sec)
Now, based on what I understood from link above, the ORDERED "user" table data in memory must be as below:
mysql> SELECT user, host FROM user ORDER BY host DESC, user DESC;
+---------------+-----------+
| user | host |
+---------------+-----------+
| sachin | localhost |
| root | localhost |
| | localhost |
| sachin | % |
| root | % |
| | % |
+---------------+-----------+
10 rows in set (0.00 sec)
Now, If I connect to my local MySQL instance as below:
mysql -u root -pmypass mysql
Based on above article, I expect the following user/host combination to be used for login:
+---------------+-----------+
| user | host |
+---------------+-----------+
| root | localhost |
+---------------+-----------+
But, after login the user connected is as mentioned below:
mysql> select current_user(), user();
+----------------+----------------+
| current_user() | user() |
+----------------+----------------+
| root@% |
root@127.0.0.1 |
+----------------+----------------+
1 row in set (0.00 sec)
querries
=========
Q1)As per article & data above, shouldn't the connected user (as per current_user() column) be root@localhost?
Q2) What is
root@127.0.0.1?
Q3) I have also seen instances (I don't remember clearly) where current_user() gave me
ODBC@127.0.0.1. Whats is this user?
Regards,
Sachin Vyas.