Chinaunix首页 | 论坛 | 博客
  • 博客访问: 2356904
  • 博文数量: 473
  • 博客积分: 12252
  • 博客等级: 上将
  • 技术积分: 4307
  • 用 户 组: 普通用户
  • 注册时间: 2007-10-12 10:02
文章分类

全部博文(473)

文章存档

2012年(8)

2011年(63)

2010年(73)

2009年(231)

2008年(98)

分类: Mysql/postgreSQL

2008-04-22 13:01:08

昨天安装的mysql今天忽然不能用了
[root@localhost mysql]# bin/mysqladmin -u root password root
bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

[root@localhost mysql]# bin/mysql -u root -p
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

#ps -aux | grep mysql

root      2197     1  0 11:23 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe
mysql     2234  2197  0 11:23 ?        00:00:00 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --pid-file=/var/run/mysqld/mysqld.pid --skip-external-locking --port=3306 --socket=/var/run/mysqld/mysqld.sock
root      2235  2197  0 11:23 ?        00:00:00 logger -p daemon.err -t mysqld_safe -i -t mysqld
mysql     3882     1  0 11:39 ?        00:00:00 mysqld
sss       3923  3891  0 11:40 pts/1    00:00:00 grep --color mysqld

在网上说是找不到mysql.sock,我是通过apt-get安装的,安装后就是没找到那个文件,解决办法:
建立链接:
# ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock

这样就能正常使用了,另外:这篇文章值得一看:

阅读(10581) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2008-05-10 23:26:21

不错,直接修改my.cnf也行,我的好像是安装mysql-client时修改了配置文件