简体   繁体   English

MySQL 数据库无法在 XAMPP for Mac 上启动

[英]MySQL Database cannot start on XAMPP for Mac

All of a sudden I am encountering this problem on my mac.突然间,我在我的 mac 上遇到了这个问题。 I cant start my MySQL Database.我无法启动我的 MySQL 数据库。 I can only start my ProFTPD and Apache Web Server.我只能启动我的 ProFTPD 和 Apache Web 服务器。

This is the application log:这是应用程序日志:

Starting all servers...
Starting MySQL Database...

Starting Apache Web Server...
/Applications/XAMPP/xamppfiles/apache2/scripts/ctl.sh : httpd started
Starting ProFTPD...
Checking syntax of configuration file
/Applications/XAMPP/xamppfiles/proftpd/scripts/ctl.sh : proftpd started

I have even did some research through stackoverflow.我什至通过stackoverflow做了一些研究。 First i tried to end the process through my activity monitor by i couldnt find the keyword sql on the filter search area.首先,我试图通过我的活动监视器结束该过程,因为我在过滤器搜索区域中找不到关键字 sql。 The second method i tried was adding the unset DYLD_LIBRARY_PATH but that didnt even worked for me.我尝试的第二种方法是添加未设置的unset DYLD_LIBRARY_PATH但这甚至对我不起作用。

Can i know how to solve this problem.我能知道如何解决这个问题。 Helps would be really appreciated.帮助将不胜感激。 Thank you谢谢

#1. Open XAMPP Installation Directory
#2. Open "etc" Folder
#3. Find "my.cnf" file and open it in any text editor
#4. Change Port from 3306 to 3307 (if you have installed skype or other apps)
#5. Add "innodb_force_recovery=1" under "myisam_sort_buffer_size=8M"
#6. Save "my.cnf" file
#7. Restart Mysql Server By Your Terminal by command:
"sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start" 

You Get A message "Starting MySQL SUCCESS! "

For me, Xampp Control panel was not launching, and in Stackoverflow some where it was mentioned to add Read / Write for every one on every file of xampp, when I did that.对我来说,Xampp 控制面板没有启动,并且在 Stackoverflow 中,有人提到在我这样做时为 xampp 的每个文件上的每个文件添加读/写。 It allowed me to launch xampp control panel but mysql was not starting.它允许我启动 xampp 控制面板,但 mysql 没有启动。

Later I debuged and found that /Applications/XAMPP/xamppfiles/etc/my.cnf should not be writeable by everyone, mysql will ignore my.cnf if it is for everyone.后来调试发现/Applications/XAMPP/xamppfiles/etc/my.cnf应该不是所有人都可以写的,mysql会忽略my.cnf如果是所有人的。 I changed the permission to read only for this file, and able to start mysql server我将此文件的权限更改为只读,并且能够启动mysql服务器

I just solve the answer by going to the activity monitor and search for sql under all process and terminate it.我只是通过转到活动监视器并在所有进程下搜索sql并终止它来解决答案。 then i restart my mac and now my sql database is working great for me.然后我重新启动我的 mac,现在我的 sql 数据库对我来说很好用。

I Know this post was originally posted last year, but I just had the same problem and I found the solution for me.我知道这篇文章最初是去年发布的,但我也遇到了同样的问题,我找到了适合我的解决方案。 So here it is, just in case this can help somebody else.所以在这里,以防万一这可以帮助其他人。

I tried all the suggestions I found online, including trying to terminate MySQL on the activity monitor, but then I realized that when you download/upgrade XAMPP - MySQL, the option to automatically start MySQLserver on Startup is ON.我尝试了我在网上找到的所有建议,包括尝试在活动监视器上终止 MySQL,但后来我意识到当你下载/升级 XAMPP - MySQL 时,启动时自动启动 MySQLserver 的选项是 ON。 You need to turn it off.您需要将其关闭。 Here is what you do:这是你要做的:

Go System Preferences and click on the Mysql icon, You should get this window:转到系统偏好设置并单击 Mysql 图标,您应该会看到这个窗口:

MySQL 窗口

Uncheck that option.取消选中该选项。 You will be asked for your password.系统将要求您输入密码。 After you are done with that, restart your computer and the problem should be fixed.完成后,重新启动计算机,问题应该得到解决。

I hope that help somebody who is as confused as I was.我希望能帮助像我一样困惑的人。 lol ✌🏼大声笑✌🏼

Xampp Control Panel> Manage Server> Mysql Database > Configure > change the port from 3306 to 3307 Xampp 控制面板> 管理服务器> Mysql 数据库> 配置> 将端口从 3306 更改为 3307

At least it worked for me in mac.至少它在mac中对我有用。

For me using macOS Catalina, I had to delete this 2 files then quit and restart the manager-osx:对于使用 macOS Catalina 的我,我必须删除这 2 个文件,然后退出并重新启动 manager-osx:

  • MyName-MacBook-Pro.local.err MyName-MacBook-Pro.local.err
  • tc.log tc.log

The folder path is this: /Applications/XAMPP/xamppfiles/var文件夹路径是这样的:/Applications/XAMPP/xamppfiles/var

Note: the 2 files were automatically regenerated after I start and Apache and MySQL注意:这两个文件在我启动和 Apache 和 MySQL 后自动重新生成

If mysql is not starting in xampp, it might be a port conflict issue.如果 mysql 没有在 xampp 中启动,则可能是端口冲突问题。 Mysql run by default on port 3306. you need to check if another application is occupying that port. Mysql 默认在 3306 端口上运行。您需要检查是否有其他应用程序占用了该端口。 use following command to check app occupying a port使用以下命令检查应用程序占用端口

lsof -nP -i4TCP:3306

if you find an application occupying that port, stop the application and restart xampp.如果您发现一个应用程序占用了该端口,请停止该应用程序并重新启动 xampp。 As an alternative, you can go to php.ini file or click configure in the dropdown and change the mysql port to 3307作为替代方案,您可以转到 php.ini 文件或单击下拉菜单中的配置并将 mysql 端口更改为 3307

I spent whole day trying to resolve this issue.我花了一整天的时间试图解决这个问题。 Changing the port no from 3306 to 3307 worked for me.将端口号从 3306 更改为 3307 对我有用。 Simply open the configure module and change the port number.只需打开配置模块并更改端口号。 Hope it works for you.希望对你有效。

In case this may help.万一这可能会有所帮助。 I followed all the steps above still nothing worked for me.我按照上面的所有步骤仍然没有对我有用。 And I follow this article MySQL database won't start in xampp and it worked.我按照这篇文章MySQL 数据库不会在 xampp 中启动并且它工作正常。 what is says is:说的是:

Steps脚步

  1. Open terminal and type打开终端并输入

    sudo su须藤

    and then put in your password然后输入你的密码

  2. Then type然后输入

    ps aux | ps辅助| grep mysql grep mysql
  3. You will need to get the process id of mysql.您将需要获取 mysql 的进程 ID。 There should be number near the top, something like 739 or 8827 (in my case I got 74689, just look after mysql or _mysql process id)顶部附近应该有数字,例如 739 或 8827 (在我的情况下,我得到了 74689,只需注意mysql_mysql进程 ID)

  4. Kill the process using使用终止进程

    kill -9 {process id}杀死 -9 {进程 ID}

    this should look something like this: kill -9 739这应该看起来像这样:kill -9 739

  5. Restart MySQL in manager-osx在 manager-osx 中重启 MySQL

If any of the above don't work, This should work:如果以上任何一项都不起作用,这应该起作用:

sudo /Applications/XAMPP/xamppfiles/bin/mysql.server start

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM