orablue 发表于 2016-03-18 21:01

mysql -h登录报错不用-h正常的原因

请问为什么-h登录本机不行,但是不用-h是可以的,请问原因是什么?

-bash-4.1$ mysql -h192.168.56.102 -P4001 -uroot -proot
ERROR 1045 (28000): Access denied for user 'root'@'192.168.56.102' (using password: YES)


-bash-4.1$
-bash-4.1$ mysql -uroot -proot --socket=/data/data/4001/mysql.sock --port=4001
Welcome to the MySQL monitor.Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.6.24-enterprise-commercial-advanced-log MySQL Enterprise Server - Advanced Edition (Commercial)

Copyright (c) 2000, 2013, 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.

mysql>
mysql> select user,host from mysql.user;
+----------+----------------+
| user   | host         |
+----------+----------------+
| checksum | %            |
| root   | %            |
| root   | 127.0.0.1      |
| checksum | 192.168.56.102 |
| root   | 192.168.56.102 |
| checksum | 192.168.56.110 |
| root   | ::1            |
|          | localhost      |
| root   | localhost      |
|          | node03         |
| root   | node03         |
+----------+----------------+
11 rows in set (0.00 sec)

mysql>

fsckzy 发表于 2016-03-19 21:46

登录本机的话, mysql -uroot -p即可。
页: [1]
查看完整版本: mysql -h登录报错不用-h正常的原因