Xampp在Mac OSX上无法启动MySQL服务器?

9
我正在使用Mac OSX Mountain Lion操作系统。Xampp无法启动MySQL服务器。
我已将XAMPP文件夹中的每个文件的权限设置为读/写权限。
错误消息显示“操作无法完成。(XAMPPErrorDomain错误1。)”
有没有想法如何停止其他MySQL进程。我试过按照Lynda.com上的端口冲突修复教程,试着在终端中输入命令“sudo lsof -i -P | grep 3306”。
然而它没有起作用,我想测试一下MySQL是否正在运行,但是没有返回结果。如何检查是否正在运行任何其他版本,然后停止任何其他MySQL服务器/卸载可能的其他版本?
这里是错误日志截图吗?那是你在寻找的东西吗? 以下是错误日志:
[Tue Dec 11 10:46:28 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 11 10:46:29 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 11 10:46:29 2012] [notice] Digest: done
[Tue Dec 11 10:46:29 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Dec 11 11:00:02 2012] [notice] caught SIGTERM, shutting down
[Tue Dec 11 11:00:33 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 11 11:00:34 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 11 11:00:34 2012] [notice] Digest: done
[Tue Dec 11 11:00:34 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Dec 11 14:14:23 2012] [notice] caught SIGTERM, shutting down
[Tue Dec 11 14:17:31 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 11 14:17:32 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 11 14:17:32 2012] [notice] Digest: done
[Tue Dec 11 14:17:32 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory
sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory
[Tue Dec 11 16:07:41 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/jessleigh/wp-admin/function.unlink, referer: http://localhost/jessleigh/wp-admin/admin.php?page=functions.php
[Tue Dec 11 16:41:51 2012] [notice] caught SIGTERM, shutting down
[Tue Dec 11 17:08:44 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 11 17:08:45 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 11 17:08:45 2012] [notice] Digest: done
[Tue Dec 11 17:08:45 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Dec 11 17:38:02 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/jessleigh
[Tue Dec 11 17:57:29 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/jessleigh
[Tue Dec 11 17:57:39 2012] [notice] caught SIGTERM, shutting down
[Tue Dec 11 17:57:44 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 11 17:57:45 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 11 17:57:45 2012] [notice] Digest: done
[Tue Dec 11 17:57:45 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Tue Dec 11 17:57:46 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/jessleigh
[Tue Dec 11 17:57:47 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/jessleigh
[Tue Dec 11 17:58:01 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/xampp/jessleigh
[Tue Dec 11 19:57:16 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/jessleigh/sample-page, referer: http://localhost/jessleigh/
[Tue Dec 11 20:07:09 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/jessleigh/sample-page, referer: http://localhost/jessleigh/
[Tue Dec 11 20:31:33 2012] [error] [client 127.0.0.1] File does not exist: /Applications/XAMPP/xamppfiles/htdocs/jessleigh/home, referer: http://localhost/jessleigh/wp-admin/post.php?post=41&action=edit&message=6
[Fri Dec 14 13:15:33 2012] [notice] caught SIGTERM, shutting down
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
(13)Permission denied: make_sock: could not bind to address [::]:80
(13)Permission denied: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[Fri Dec 14 18:20:53 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Fri Dec 14 18:20:54 2012] [notice] Digest: generating secret for digest authentication ...
[Fri Dec 14 18:20:54 2012] [notice] Digest: done
[Fri Dec 14 18:20:54 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
[Fri Dec 14 18:24:24 2012] [notice] caught SIGTERM, shutting down
[Tue Dec 18 12:00:06 2012] [warn] Init: Session Cache is not configured [hint: SSLSessionCache]
[Tue Dec 18 12:00:07 2012] [notice] Digest: generating secret for digest authentication ...
[Tue Dec 18 12:00:07 2012] [notice] Digest: done
[Tue Dec 18 12:00:07 2012] [notice] Apache/2.2.14 (Unix) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l PHP/5.3.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations
:

tail -2 /opt/lampp/logs/error_log仅返回翻译的文本。 - Jonathan de M.
@JonathandeM. 嘿,我正在使用Xampp而不是Lampp。无论如何,我该如何使用那个命令呢? - jaycodez
tail -2 /opt/xampp/logs/error_log,使用自动补全,我不确定路径。 - Jonathan de M.
error_log 是 Apache 的错误日志。MySQL 的错误日志应该是 <机器名称>.err,不知道在 XAMPP 中的路径。我使用 AMPPS。 - Jigar
7个回答

33

您可以在终端中执行以下命令检查是否有任何mysql实例正在运行

sudo ps aux | grep mysql
这将列出任何名称中包含mysql的进程。
_mysql          18943   0,0  0,5  2514608  20340 s008  S+    5:46am   0:00.07   /opt/local/libexec/mysqld --basedir=/opt/local --datadir=/opt/local/var/db/mysql5 --  user=_mysql --log-error=/opt/local/var/db/mysql5/Max-NB.local.err --pid-  file=/opt/local/var/db/mysql5/Max-NB.local.pid
root            18900   0,0  0,1  2439964   2592 s008  S+    5:46am   0:00.15 /bin/sh   /opt/local/bin/mysqld_safe5
root            18899   0,0  0,1  2439396   2616 s008  S+    5:46am   0:00.02 sudo   mysqld_safe5

您可以通过执行其终止进程

sudo killall mysqld_safe5

您应该将“mysqld_safe5”替换为您的MySQL进程名称,最可能是“mysqld”。

之后,您可以尝试重新启动服务器并检查是否正常工作。


为什么要使用 sudo ps aux 而不是只用 ps aux - Waleed Khan
我从截图中看到您试图通过将日志文件的名称粘贴到终端来查看error.log。这样做,bash会认为您在该路径上运行脚本。请尝试改为运行“less /Applications/XAMPP/xamppfiles/logs/error_log”。 - Max
1
@Max,我已经上传了一张截图,不确定如何终止该进程? - jaycodez
error_log 是 Apache 的错误日志。MySQL 的错误日志应该是 <machine-name>.err,但我不知道 XAMPP 中的路径。我使用 AMPPS。 - Jigar
3
正确答案是重新安装Xampp并重新开始,但这也很接近。 :) - jaycodez
显示剩余2条评论

12
chmod -R 777 /Applications/XAMPP/xamppfiles/var

这对我解决了问题。参考 - StackOverflow 问题

但是在生产服务器上不要这样做,你可能需要更改所有者或组(使用chownchgrp)以解决问题。


谢谢伙计,你的解决方案也解决了我的问题 :)。 - Altaf Hussain
这也解决了我的问题。谢谢。 - pmandell

0

我曾经遇到过同样的问题,但是通过用原始文件替换my.cnf文件来解决了它。 这个文件有一行代码,删除它就解决了问题。

listen 80

0

首先阅读位于/Applications/XAMPP/xamppfiles/logs/error_log的错误文件,通常出现此错误意味着3306端口已被占用。


我打开了那个文件并在终端中截取了一个屏幕截图,将其添加在上面。我该如何查看error_log? - jaycodez
请检查您是否将XAMPP文件夹放在根文件夹中,例如:/Applications。如果您将xampp文件夹放在根目录之外(嵌套到某个级别,例如/Applications/abc/xampp),则有时会出现问题。 - Varun Bajaj
是的,它肯定在根文件夹中。 - jaycodez

0

你应该尝试配置你的 MySql 数据库,并将端口从 3306 改为 3307,这对我很有效。有时候这个端口会很忙碌,无法在你的电脑上工作。


你知道原始问题是在2012年发布的,对吧? - Mike

0

查看错误日志,您可能会发现:

[ERROR] tc 日志中的错误魔数头
[ERROR] 无法初始化 tc 日志

删除 /Applications/XAMPP/xamppfiles/var/mysql/tc.log 并重新启动 mysql。


-3

你可以在你的Mac book上使用MAMP PRO。但是有一个问题,如果你不注册或激活它,它只能工作14天。

我在这里分享一些截图...

1.安装后,打开并选择phpMyAdmin1

2.接下来进入Database2

3.然后你可以创建数据库并在那里添加列3


这个问题是8年前的。而且答案并没有回答这个问题(请求更改软件并不是解决某个软件问题的方案)。 - Sakura Kinomoto

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接