发布于 2014-12-06 08:52:00 | 485 次阅读 | 评论: 1 | 来源: PHPERZ
Mysql关系型数据库管理系统
MySQL是一个开放源码的小型关联式数据库管理系统,开发者为瑞典MySQL AB公司。MySQL被广泛地应用在Internet上的中小型网站中。由于其体积小、速度快、总体拥有成本低,尤其是开放源码这一特点,许多中小型网站为了降低网站总体拥有成本而选择了MySQL作为网站数据库。
本文为大家讲解的是mysql错误:Can't connect to local MySQL server through socket解决方法,感兴趣的同学参考下。
错误描述:
连接mysql报找不到sock 错误如下 :
[root@app60 mysqld]# /usr/bin/mysql -uroot -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (111)
[root@app60 mysqld]#
错误原因:
mysql找不到mysql.sock的位置,比如在安装时mysql.sock的位置不是在默认目录下。
解决方法:
登陆的时候加上sock参数就OK了。
[root@app60 mysqld]# /usr/bin/mysql -uroot -p --socket=/opt/mysqldata/mysql.sock
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.69 Source distribution
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>