码迷,mamicode.com
首页 > 数据库 > 详细

MySQL本地用IP登陆而非socket

时间:2020-01-23 00:00:37      阅读:134      评论:0      收藏:0      [点我收藏+]

标签:other   man   register   ade   roo   nec   oracle   enter   tmp   

##想当然的指定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>

MySQL本地用IP登陆而非socket

标签:other   man   register   ade   roo   nec   oracle   enter   tmp   

原文地址:https://blog.51cto.com/accole/2468277

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!