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>
连接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>
编辑回复