[root@CactiEZ bin]# ./mysql -u roo -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
修改my.cnf文件
保存后重启服务
[root@CactiEZ etc]# /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]
在次登入时报
mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
就再次修改配置文件
保存退出。
20130530补充
当按照上面方法不能成功时,还是提示
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)
此时要看是否系统的为mysql.sock文件的
这样配置后就可以正常启动了
之后按照这个方法进行密码修改
http://www.blogjava.net/wiflish/archive/2006/12/23/89655.html