Maison >base de données >tutoriel mysql >ERROR 2002 (HY000): Can't connect to local MySQL se_MySQL
今天安装一键lnmp包,安装完之后顺利进入测试页。看到测试页有个phpMyAdmin的链接,点击试下,发现一片空白。
顺手打开终端执行mysql,很不幸,报错
root@kali:~# mysqlERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)首先想到的当然是查看错误日志,打开mysql的错误日志文件,fuck,空文件....这TM是在逗我么。。。
此时博主忽然想到大神 : Lellansin's 冰森(http://www.lellansin.com/) 博客上好像有这样一篇博文,仔细阅读之,他那篇文章中所描诉的情况是磁盘被占满导致的。但是我这磁盘明显是够用的。蛋疼ing...
按照以往的经验,博主必然会选择重启。当然,这次也不例外,执行
service mysql restart出现以下错误
[FAIL] MySQL server PID file could not be found! ... failed!Starting MySQL[ o.你没看错,MYSQL的PID没有,进程压根没启动
ps -ef|grep mysql查看进程有没有起来
root@kali:/var/log# ps -ef|grep mysqlroot 23646 10 09:35 pts/100:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/kali.pidmysql24017 236460 09:35 pts/100:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/var/kali.err --pid-file=/usr/local/mysql/var/kali.pid --socket=/tmp/mysql.sock --port=3306root 24059 234130 09:35 pts/100:00:00 grep mysql没错,进程已经起来,那么再执行mysql命令
root@kali:/var/log# mysqlERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)现在报的错误是密码错误,这样就简单了,问题解决。
博主记录这个过程旨在说明出现
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
这个错误也有可能是mysql的进程没起来的原因。