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>
阅读(17160) | 评论(0) | 转发(0) |