当前位置: 技术问答>linux和unix
centos安装mysql,连接时'Can't connect to local MySQL server through socket '/tmp/mysql
来源: 互联网 发布时间:2017-05-20
本文导语: 安装步骤:http://blog.s135.com/nginx_php_v6/,安装至mysql,可以启动,但不能连接 执行以下命令,结果 [root@localhost /]# /usr/local/webserver/mysql/bin/mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock...
安装步骤:http://blog.s135.com/nginx_php_v6/,安装至mysql,可以启动,但不能连接
执行以下命令,结果
[root@localhost /]# /usr/local/webserver/mysql/bin/mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@localhost /]# ps -f | grep mysqld
root 421 5858 0 19:46 pts/1 00:00:00 grep mysqld
root 19860 1 0 16:22 pts/1 00:00:00 /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/3306/my.cnf
[root@localhost /]# kill 421
bash: kill: (421) - No such process
执行以下命令,结果
[root@localhost /]# /usr/local/webserver/mysql/bin/mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
[root@localhost /]# ps -f | grep mysqld
root 421 5858 0 19:46 pts/1 00:00:00 grep mysqld
root 19860 1 0 16:22 pts/1 00:00:00 /bin/sh /usr/local/webserver/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/3306/my.cnf
[root@localhost /]# kill 421
bash: kill: (421) - No such process
|
touch /tmp/mysql.sock
chmod 777 /tmp/mysql.sock
chown /tmp/mysql.sock mysql
chmod 777 /tmp/mysql.sock
chown /tmp/mysql.sock mysql