mysql启动不了:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket

ps aux |grep mysql

kill所有列出的进程,然后重启

service mysql start

原因有可能是mysqld没启动;service mysqld start。

持续出现此问题有可能是配置文件不对。

修改/usr/my.cnf   (一般是/etc/my.cnf)

[mysqld]
datadir=/usr/local/mysql/data
socket=/var/lib/mysql/mysql.sock

[mysql.server]
user=mysql
basedir=/usr/local/mysql

If there is not currently a section called [client], add one at the bottom of the file and copy the socket= line under the [mysqld] section such as:
[client]
socket=/var/lib/mysql/mysql.sock

其他问题:

1、先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动.
另外看看是不是权限问题.
2、确定你的mysql.sock是不是在那个位置,
mysql -u 你的mysql用户名 -p -S /var/lib/mysql/mysql.sock
3、如果是权限问题,则先改变权限 #chown -R mysql:mysql /var/lib/mysql
[[email protected] ~]# /etc/init.d/mysqld start
启动 MySQL: [ 确定 ]
[[email protected] ~]# mysql -uroot –p

转:http://www.cnblogs.com/visi_zhangyang/archive/2012/03/05/2380531.html

时间: 2024-10-21 08:24:50

mysql启动不了:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket的相关文章

【Problem】xampp in ubuntu下命令行启动mysql报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2)

xampp in ubuntu下命令行启动mysql报错: [email protected]:/opt/lampp$ ./bin/mysql -u root -p Enter password: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/lampp/var/mysql/mysql.sock' (2) 启动mysql服务: [email protected]:/opt/lampp$ /

MYSQL错误解决:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 据说这个问题的原因很多,当然,我自己这个问题我是清楚的,就是mysql.sock的位置所致,一个是PHP要求的,一个是MYSQLD定义的,一个是MY.CONF指定的...SO.... 暂时不能统一的话,用软链接LN -S命令解决吧.. 方案5 摘要:解决不能通过mysql.sock连接MySQ

mysql连接报错 ERROR 2002 (HY000): Can't connect to local MySQL server through socket

安装完mysql连接报错: [[email protected] app]# mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) [[email protected] app]# mysql -uroot -p Enter password:  ERROR 2002 (HY000): Can't connect to local M

MySQL登录报错ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

[[email protected] mysql3307]# /opt/mysql3307/bin/mysql -upisp [email protected]123 mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.so

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了 ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can’t connect

安装mysql后ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了

ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2) 1.先查看 /etc/rc.d/ini

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var mysql 启动不了(转载)

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var mysql 启动不了 ps -A | grep -i mysql kill 列出来的进程 service mysql start 我的问题就解决了 ---------------------------------------------- Fedora8启动mysql 报错:ERROR 2002 (HY000): Can't connect

ERROR 2002 (HY000): Can't connect to local MySQL解决方法

启动mysql 报错: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s q l 是否已经启动. 另外看看是不是权限问题. 2.确定你的mysql.sock是不是在那个位置, mysql -u 你的mysql用户名 -p -S /var/lib/mysq

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)--MySQL错误

环境:RHEL5.5 centos的yum源更新 1.启动MySQL出现错误: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 2.解决方法(摘自:http://wenda.haosou.com/q/1364099334067193?src=150) 1.先查看 /etc/rc.d/init.d/mysqld status 看看m y s

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 的解决办法

更换mysql数据目录后出现ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) 的解决办法 于是关闭mysql服务: service mysqld stop 转移mysql数据目录 mv /var/lib/mysql/ /data/ 编辑my.cnf vi /etc/my.cnf 修改其中的datadir和socket到新的路径 [mysqld