mysqld 无法启动,并且 mysql 错误 2002

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14179007/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 16:03:52  来源:igfitidea点击:

mysqld failing to start, and mysql error 2002

mysqldebianlamp

提问by DrDeviation

Okay, I've looked around, but I'm very confused with the problem. Please forgive me if it's something stupid. :*S I'm running 32bit Debian 6.0.6.

好吧,我环顾四周,但我对这个问题很困惑。如果这是愚蠢的,请原谅我。:*S 我正在运行 32 位 Debian 6.0.6。

    root@debian:~# service mysql start
    Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!

So, the the service fails to start.

因此,该服务无法启动。

    root@debian:~# mysql
    ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

And this is the error given when running the command mysql. Is this error because mysqld failed to start? Or is there another reason?

这是运行命令mysql时给出的错误。这个错误是因为mysqld无法启动吗?还是另有原因?

I went to the directory, /var/mysqld/ and there wasn't a file named mysqld.sock. Is that the issue, or am I an idiot? hahah. Any help would be greatly appreciated. Thank you for your time.

我转到目录 /var/mysqld/ 并且没有名为 mysqld.sock 的文件。是这个问题,还是我是白痴?哈哈。任何帮助将不胜感激。感谢您的时间。

EDIT: Also, it appears that logs associated with mysql, such as mysql.log and mysql.err have no value to them, they're blank. Also, I've chmod 777'd all the directories that mysql acts in. The service still continues to refuse running.

编辑:此外,似乎与 mysql 相关的日志,例如 mysql.log 和 mysql.err 对它们没有价值,它们是空白的。另外,我已经 chmod 777'd mysql 作用的所有目录。该服务仍然继续拒绝运行。

回答by Kirk

Try to track down the error a bit differently. Run MySQL in the foreground.

尝试以不同的方式追踪错误。在前台运行 MySQL。

mysqld_safe --log-error=/var/log/mysql.err

This should produce a log with some details at /var/log/mysql.errhopefully and add the details to your question if any in case my solution below doesn't work and someone else can help.

这应该会产生一个包含一些详细信息的日志,/var/log/mysql.err如果有的话,如果我的下面的解决方案不起作用并且其他人可以提供帮助,请将详细信息添加到您的问题中。

You may end up getting an error mysqld_safe: command not foundand if you do, use the locatecommand to find it.

您最终可能会遇到错误mysqld_safe: command not found,如果确实如此,请使用该locate命令来查找它。

locate mysqld_safe

This will tell you where it is. For example, if it returns /usr/bin/mysqld_safe, run the command

这会告诉你它在哪里。例如,如果返回/usr/bin/mysqld_safe,则运行命令

/usr/bin/mysqld_safe --log-error=/var/log/mysql.err

If I had to hazard a guess, you will find an error about pthreads.

如果我不得不冒险猜测,您会发现关于pthreads的错误。

InnoDB: Error: pthread_create returned 12

If this is the case, the easy solution is to disable InnoDBfor MySQL. Chances are you won't need this, so disable it in the config.

如果是这种情况,简单的解决方案是禁用InnoDBfor MySQL。你可能不需要这个,所以在配置中禁用它。

To turn off InnoDB, edit the MySQL configuration file at /etc/mysql/my.cnfand add this to it

要关闭 InnoDB,请编辑 MySQL 配置文件/etc/mysql/my.cnf并将其添加到其中

skip-innodb

Now start MySQL

现在启动 MySQL

/etc/init.d/mysql start

回答by gael

I had the same problem.

我有同样的问题。

The /tmp dir was not writbale, so MYSQL couldn't write some needed file.

/tmp 目录不是 writbale,所以 MYSQL 无法写入一些需要的文件。

Just do this :

只需这样做:

chmod 777 /tmp

and restart mysql

并重新启动mysql

/etc/init.d/mysql start

回答by Secko

I had the same problem for days, and it was my network (DHCP) along with mysql configuration (which I always experiment with).

几天来我遇到了同样的问题,这是我的网络 (DHCP) 和 mysql 配置(我一直在试验)。

This may help you:

这可能会帮助您:

  • open /etc/mysql/my.cnf
  • find bind-addressand make sure the ip address is correct or commented out like so #bind-address
  • 打开 /etc/mysql/my.cnf
  • 查找bind-address并确保 IP 地址正确或像这样注释掉 #bind-address

回答by makapu

I had the same

我有同样的

I've uninstalled zlib1g-dev and all went fine

我已经卸载了 zlib1g-dev 并且一切顺利