昨天安装的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
这样就能正常使用了,另外:这篇文章值得一看:
阅读(10607) | 评论(1) | 转发(0) |