Chinaunix首页 | 论坛 | 博客
  • 博客访问: 951123
  • 博文数量: 83
  • 博客积分: 32
  • 博客等级: 民兵
  • 技术积分: 2080
  • 用 户 组: 普通用户
  • 注册时间: 2010-08-12 09:45
个人简介

努力学习,努力分享,努力.....在努力..努力离开..

文章分类

全部博文(83)

文章存档

2017年(3)

2015年(1)

2014年(47)

2013年(32)

分类: Mysql/postgreSQL

2013-10-28 17:07:04

mysql服务器本机上连接DB时经常会出现mysql.sock不存在

[root@DB mysql]# mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/usr/local/mysql/mysql.sock' (2)

原因:
如果指定localhost作为一个主机名,则mysqladmin默认使用UNIX套接字连接,而不是TCP/IP而这个套接字文件一般命名为mysql.sock.

解决:
手动指定TCP连接,问题解决
[root@DB mysql]# mysql --protocol=TCP -uroot -p 3306 -hlocalhost
Enter password: ******
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.6.14 MySQL Community Server (GPL)


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>
阅读(17117) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~