加入收藏 | 设为首页 | 会员中心 | 我要投稿 聊城站长网 (https://www.0635zz.com/)- 智能语音交互、行业智能、AI应用、云计算、5G!
当前位置: 首页 > 站长学院 > MySql教程 > 正文

在 MySQL 中,我们使用 IP地址而不是套接字来登录

发布时间:2023-07-27 14:33:54 所属栏目:MySql教程 来源:
导读:##想当然的指定hostname和端口。。。。失败

[root@mysql01 ~]# /opt/mysql/bin/mysql -uroot -h localhost -P 3307 -p

Enter password:

ERROR 2002 (HY000): Can't connect to local MySQL server t
##想当然的指定hostname和端口。。。。失败
 
[root@mysql01 ~]# /opt/mysql/bin/mysql -uroot -h localhost -P 3307 -p
 
Enter password:
 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
 
##正确方法,指定通信协议 --protocol tcp
 
[root@mysql01 ~]# /opt/mysql/bin/mysql -uroot -h localhost -P 3307 -p --protocol tcp
 
Enter password:
 
Welcome to the MySQL monitor. Commands end with ; or \g.
 
Your MySQL connection id is 8
 
Server version: 5.6.31-log Source distribution
 
Copyright (c) 2000, 2016, 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>
 
 

(编辑:聊城站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章