欢迎各位兄弟 发布技术文章
这里的技术是共享的
[root@mail ~]# mysql -h 127.0.01 -u root #这是可以的
[root@mail ~]# mysql -h localhost -u root # 把 127.0.0.1改成localhost 就不可以
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[root@mail ~]# locate mysql.sock
/mydata/data/mysql.sock
[root@mail ~]# ln -s /mydata/data/mysql.sock /var/lib/mysql/mysql.sock #建一个到 /var/lib/mysql/mysql.sock 的软链接吧
[root@mail ~]# mysql -h localhost -u root #此时可以了 ( 此时 直接输 # mysql 也可以 )
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.0.95 Source distribution
Copyright (c) 2000, 2011, 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>