Recently in the MySQL multi-instance, the use of different ways to log into the MySQL database, found mysql-uroot-p-h 127.0.0.1-p3308, log in incredibly do not password can login 650) this.width=650; "Src=" http ://img.baidu.com/hi/jx2/j_0064.gif "alt=" J_0064.gif "/>, frighten me a sweat, after the examination finally found the reason to record, for the small white reference. 650) this.width=650; "src=" Http://img.baidu.com/hi/jx2/j_0051.gif "alt=" J_0051.gif "/>
[Email protected] ~]# mysql-uroot-p-s/data/3308/mysql.sock
Enter Password: #需要输入密码
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 23
Server Version:5.5.32-log Source Distribution
Copyright (c) and/or, Oracle, its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql> select Current_User ();
+----------------+
| Current_User () |
+----------------+
| [Email protected] |
+----------------+
1 row in Set (0.00 sec)
*******************************************************************
[Email protected] ~]# mysql-uroot-p-H 127.0.0.1-p3308
Enter password: #不需要输入密码, direct Enter login
Welcome to the MySQL Monitor. Commands End With; or \g.
Your MySQL Connection ID is 24
Server Version:5.5.32-log Source Distribution
Copyright (c) and/or, Oracle, its affiliates. All rights reserved.
Oracle is a registered trademark of the Oracle Corporation and/or its
Affiliates. Other names trademarks of their respective
Owners.
Type ' help ', ' or ' \h ' for help. Type ' \c ' to clear the current input statement.
Mysql>
Mysql> select Current_User ();
+----------------+
| Current_User () |
+----------------+
| [Email protected] |
+----------------+
1 row in Set (0.00 sec)
Do not password login reason:
Log in to the database to view passwords
Mysql> select User,host,password from Mysql.user;
+------+-----------+-------------------------------------------+
| user | Host | password |
+------+-----------+-------------------------------------------+
| Root | localhost | *fe28814b4a8b3309dac6ed7d3237aded6da1e515 |
| Root | MySQL | |
| Root | 127.0.0.1 | |
| Root | :: 1 | |
| | localhost | |
| | MySQL | |
| Tom | % | *71ff744436c7ea1b954f6276121db5d2bf68fc07 |
| tom1 | % | *36b46f2410b8a8e6e1dc6952c5c26929fdc07421 |
| Tom2 | % | *FEF6FE64F2588DC11E69F0DC5A704E231D1AAEFC |
| Tom | localhost | *71ff744436c7ea1b954f6276121db5d2bf68fc07 |
+------+-----------+-------------------------------------------+
Rows in Set (0.00 sec)
Summary: The first way to login, the user is [email protected], the second way to log in, the user is [email protected] To view the database, found [email protected] Not set the password, so the first way to login does not need to enter a password.
This article is from the "Knowledge Change Destiny" blog, please be sure to keep this source http://ahtornado.blog.51cto.com/4826737/1894464
MySQL multi-instance login password test