免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4611 | 回复: 1
打印 上一主题 下一主题

mysql -h登录报错不用-h正常的原因 [复制链接]

论坛徽章:
1
2015亚冠之西悉尼流浪者
日期:2015-05-18 14:38:40
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-03-18 21:01 |只看该作者 |倒序浏览
请问为什么-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>

论坛徽章:
2
IT运维版块每日发帖之星
日期:2016-03-22 06:20:00数据库技术版块每日发帖之星
日期:2016-03-22 06:20:00
2 [报告]
发表于 2016-03-19 21:46 |只看该作者
登录本机的话, mysql -uroot -p即可。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP