我不小心永久删除了MySQL套接字文件('/tmp/mysql.sock'),我该如何解决?

时间:2016-07-13 12:20:32

标签: mysql database sockets

之后,我重新安装了mysql,但仍然得到:Can't connect to Error: local MySQL server through socket'/tmp/mysql.sock'(2)

尝试启动服务器:start mysql.server,但得到了:

ERROR! The server quit without updating PID file (/usr/local/var/mysql/appledeMacBook-Pro-6.local.pid).

接下来我尝试的是:

mysqladmin -h 127.0.0.1 -u root -p shutdown

得到了:

mysqladmin: connect to server at '127.0.0.1' failed
error: 'Can't connect to MySQL server on '127.0.0.1' (61)'
Check that mysqld is running on 127.0.0.1 and that the port is 3306.
You can check this by doing 'telnet 127.0.0.1 3306'

我按照这个提示(telnet 127.0.0.1 3306)得到了:

connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

我该如何解决这个问题?

2 个答案:

答案 0 :(得分:1)

  • ps aux | grep mysql
  • sudo kill -9 [PID]
  • sudo mysql.server start

答案 1 :(得分:0)

我希望你尝试重新启动你的机器,我希望你给mysql正确的写入权限。