连接mysql提示故障: socket '/tmp/mysql.sock' (2)

回复 收藏
1.问题描述
连接mysql数据库时用:/usr/local/mysql/bin/mysql -uroot 提示下面故障处理:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
2.处理办法:
  编辑/etc/my.cnf,添加一行:socket=/tmp/mysql.sock
[mysql]
no-auto-rehash
socket=/tmp/mysql.sock  //新添加的
# Remove the next comment character if you are not familiar with SQL
#safe-updates
3.重新启动mysql,service mysqld restart
4.登陆成功:
[root@localhost ~]# /usr/local/mysql/bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.72-log 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>



2016-02-21 19:34 举报
已邀请:
0

469327849

赞同来自:

{:7_229:}

回复帖子,请先登录注册

退出全屏模式 全屏模式 回复
评分
可选评分理由: