无法在 Mac OS 10.6 Snow Leopard 中启动 MySql

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1334272/
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 13:59:02  来源:igfitidea点击:

can't start MySql in Mac OS 10.6 Snow Leopard

mysqlmacososx-snow-leopard

提问by nacho4d

I've googled this and could'nt find anything new and useful for Apple's new OS SnowLeopard. I wonder if this is my mistake or I do need to do something?

我在谷歌上搜索过这个,找不到任何对 Apple 的新操作系统 SnowLeopard 有用的新东西。我想知道这是我的错误还是我确实需要做些什么?

this is what I did:

这就是我所做的:

Downloaded from mysql site: http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmgI choose : Mac OS X 10.5 (x86_64)

从 mysql 站点下载:http: //dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg我选择:Mac OS X 10.5 (x86_64)

I run all the packages and installed all of them. So now I certainly have mysql in

我运行了所有的包并安装了所有的包。所以现在我当然有 mysql

/usr/local/mysql/

But when trying to start it from preferences panel, it is always STOPPED. When I try to do (in the terminal):

但是当尝试从首选项面板启动它时,它总是停止。当我尝试做(在终端中)时:

/usr/local/mysql/bin/mysql

I got :

我有 :

-bash: /usr/local/mysql/bin/mysql: Bad CPU type in executable

-bash: /usr/local/mysql/bin/mysql: 可执行文件中的 CPU 类型错误

What is wrong here? Any help would be very appreciated. Thanks

这里有什么问题?任何帮助将不胜感激。谢谢

采纳答案by nacho4d

Okay... Finally I could install it! Why? or what I did? well I am not sure. first I downloaded and installed the package (I installed all the files(3) from the disk image) but I couldn't start it. (nor from the preferences panel, nor from the termial)

好吧……我终于可以安装它了!为什么?或者我做了什么?我不确定。首先,我下载并安装了该软件包(我从磁盘映像安装了所有文件 (3)),但无法启动它。(也不是来自首选项面板,也不是来自终端)

second I removed it and installed through mac ports.

其次,我将其删除并通过 mac 端口安装。

again, the same thing. could not start it.

再次,同样的事情。无法启动它。

Now I deleted it again, installed from the package. (i am not sure if it was the exact same package but I think it is) Only this time I got the package from another site(its a mirror).

现在我再次删除它,从包中安装。(我不确定它是否是完全相同的包,但我认为是)只是这次我从另一个站点(它的镜像)获得了包。

the site:

网站:

http://www.mmisoftware.co.uk/weblog/2009/08/29/mac-os-x-10-6-snow-leopard-and-mysql/

http://www.mmisoftware.co.uk/weblog/2009/08/29/mac-os-x-10-6-snow-leopard-and-mysql/

and the link:

和链接:

http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-5.1.37-osx10.5-x86.dmg

http://mirror.services.wisc.edu/mysql/Downloads/MySQL-5.1/mysql-5.1.37-osx10.5-x86.dmg

1.- install mysql-5-1.37-osx10.5-x86.pkg

1.- 安装 mysql-5-1.37-osx10.5-x86.pkg

2.- install MySQLStartupItem.pkg

2.- 安装 MySQLStartupItem.pkg

3.- install MySQL.prefpanel

3.- 安装 MySQL.prefpanel

And this time is working fine (even the preferences panel!)

这次工作正常(甚至是首选项面板!)

Nothing special, I don't know what happened the first two times.

没什么特别的,我不知道前两次发生了什么。

But thank you all. Regards.

不过谢谢大家。问候。

回答by Janvb

Maybe this answer helps:

也许这个答案有帮助:

mysql5.58 unstart server in mac os 10.6.5

mysql5.58 在 mac os 10.6.5 中重启服务器

I just installed MySQL 5.5.8 (mysql-5.5.8-osx10.6-x86_64.dmg) on Mac os X 10.6.5 and also had the problem that MySQL was not starting.

我刚刚在 Mac os X 10.6.5 上安装了 MySQL 5.5.8 (mysql-5.5.8-osx10.6-x86_64.dmg),也遇到了 MySQL 无法启动的问题。

After reading this post: http://forums.mysql.com/read.php?11,399397,399606#msg-399606and editing the file as suggested everything started working.

阅读这篇文章后:http: //forums.mysql.com/read.php?11,399397,399606#msg-399606并按照建议编辑文件后一切开始工作。

I also did

我也做了

sudo chown -R root:wheel /Library/StartupItems/MySQLCOM

after reading https://discussions.apple.com/message/12820394since when restarting my Mac OSx 10.6.6 it kept on asking something about not enough privileges. The line above solved that issue.

阅读 https://discussions.apple.com/message/12820394 后,自从重新启动我的 Mac OSx 10.6.6 后,它一直在询问有关权限不足的问题。上面的行解决了这个问题。

Now everything is working.

现在一切正常。

回答by Janvb

YOU MUST REINSTALL mySQL after upgrading to Snow Leopard and remove any previous versions as well as previous startup from the preference panel. install 86_64 10.5...I find the others did not work for me.

升级到 Snow Leopard 后,您必须重新安装 mySQL,并从首选项面板中删除任何以前的版本以及以前的启动。安装 86_64 10.5...我发现其他人不适合我。

  1. Download MySQL version Mac OS X 10.5 (x86_64) located at http://dev.mysql.com/downloads/mysql/5.4.html#macosx-dmg
  2. Install startup Item (follow instructions)
  3. Then install the beta version (follow instructions)
  4. If you want the start up in the Preference Panel...install mySQL.prefpane I find that SQL does not run from the terminal unless you start mySQL in the preference panel.
  1. 下载位于http://dev.mysql.com/downloads/mysql/5.4.html#macosx-dmg 的MySQL 版本 Mac OS X 10.5 (x86_64)
  2. 安装启动项(按照说明)
  3. 然后安装测试版(按照说明)
  4. 如果您想在首选项面板中启动...安装 mySQL.prefpane 我发现 SQL 不会从终端运行,除非您在首选项面板中启动 mySQL。

回答by xgretsch

In order just to get MySQL working again (I haven't yet looked at startup), there is no need to reinstall . I've got my copy working by doing the following:

为了让 MySQL 再次工作(我还没有看过启动),没有必要重新安装 . 我通过执行以下操作使我的副本正常工作:

What you need to do is this:

你需要做的是:

sudo ln -s /usr/local/mysql-5.0.51a-osx10.5-x86_64 /usr/local/mysql

sudo ln -s /usr/local/mysql-5.0.51a-osx10.5-x86_64 /usr/local/mysql

This creates a symbolic link from the /usr/local/mysql directory to the location where MySQL is. This is critical, because unless you carefully backed up all your databases with mysqldump before running the Leopard upgrade, that's where all your data lives - and restoring it simply from a whole-hard-drive backup is going to be hard.

这会创建一个从 /usr/local/mysql 目录到 MySQL 所在位置的符号链接。这很关键,因为除非您在运行 Leopard 升级之前使用 mysqldump 仔细备份所有数据库,否则所有数据都存放在那里 - 并且仅从整个硬盘驱动器备份中恢复它会很困难。

Now you can go to the right directory and start up mysql:

现在您可以转到正确的目录并启动mysql:

cd /usr/local/mysql-5.0.51a-osx10.5-x86_64

cd /usr/local/mysql-5.0.51a-osx10.5-x86_64

sudo ./bin/mysqld_safe

sudo ./bin/mysqld_safe

You can now do the usual CTRL-Z to get back to the shell. To make sure mysqld is running, type:

您现在可以执行通常的 CTRL-Z 返回 shell。要确保 mysqld 正在运行,请键入:

sudo ps -A|grep mysql

sudo ps -A|grep mysql

I got something like this:

我得到了这样的东西:

1220 ttys000 0:00.02 /bin/sh ./bin/mysqld_safe
1240 ttys000 0:00.39 /usr/local/mysql-5.0.51a-osx10.5-x86_64/bin/mysqld --basedir=/usr/local/mysql-5.0.51a-osx10.5-x86_64 --datadir=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data --user=mysql --pid-file=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data/dkmac-2.home.pid --port=3306 --socket=/tmp/mysql.soc

1220 ttys000 0:00.02 /bin/sh ./bin/mysqld_safe
1240 ttys000 0:00.39 /usr/local/mysql-5.0.51a-osx10.5-x86_64/bin/mysqld --basedir=/usr/local/mysql-5.0.51a-osx10.5-x86_64 --datadir=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data --user=mysql --pid-file=/usr/local/mysql-5.0.51a-osx10.5-x86_64/data/dkmac-2.home.pid --port=3306 --socket=/tmp/mysql.soc

My copy of mysql now seems to work fine. At the very least, it's good enough to run mysqldump on all my databases, so that if I need to upgrade mysql by other means and dump my data directory, I'm still in good shape.

我的 mysql 副本现在似乎工作正常。至少,在我所有的数据库上运行 mysqldump 已经足够了,这样如果我需要通过其他方式升级 mysql 并转储我的数据目录,我仍然处于良好状态。

回答by dritttenbach

First of all can I just say that I really really love the Internet community for all that it does in providing answers to everybody. I don't post a lot but everybody's posting here and on so many boards helped me so much! None of them gave me the right answer mind you, but here is my unique solution to this nightmare of a spending 2 solid days trying to install MySQL 5.5.9 on Snow Leopard 10.6. Skip to bottom for resolution.

首先,我可以说我真的很喜欢互联网社区,因为它为每个人提供答案。我不怎么发帖,但是每个人都在这里发帖,在这么多的论坛上发帖对我帮助很大!请注意,他们都没有给我正确的答案,但这是我对花费 2 天尝试在 Snow Leopard 10.6 上安装 MySQL 5.5.9 的噩梦的独特解决方案。 跳到底部以获得分辨率。

Here's what happened.

这就是发生的事情。

I had a server crash recently. The server was rebuilt and of course MySQL 5.5.8 didn't work. What a worthless piece. I had 5.1.54 on my other machine. That had been a pain to install as well but not like this.

我最近服务器崩溃了。服务器已重建,当然 MySQL 5.5.8 不起作用。多么不值钱的一块。我的另一台机器上有 5.1.54。安装起来也很痛苦,但不是这样。

I had all sorts of issues installing with the dmg from mysql.org, installing mysql5 using macports, uninstalling trying to revert to 5.1.54 (couldn't because I couldn't find the receipt file with that info even though I followed the directions). After rming everything I could find related to mysql and then reinstalling 5.5.8 everything worked! Until I rebooted... ? I looked in my system preference mysql pane and found mysql server wasn't starting. (skip to end for resolution)

我在从 mysql.org 安装 dmg、使用 macports 安装 mysql5、卸载尝试恢复到 5.1.54 时遇到了各种各样的问题(无法找到,因为即使我按照说明操作,我也找不到带有该信息的收据文件)。在 rming 我能找到的所有与 mysql 相关的东西之后,然后重新安装 5.5.8 一切正常!直到我重新启动...?我查看了我的系统首选项 mysql 窗格,发现 mysql 服务器没有启动。(跳到结尾解决)

My first error (super common) included: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' and numerous other EXTREMELY common issues related to mysql.sock http://forums.mysql.com/read.php?11,9689,13272

我的第一个错误(超级常见)包括:ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysql.sock' 和许多其他与 mysql.sock http相关的极其常见的问题 : //forums.mysql.com/read.php?11,9689,13272

Here were things I tried: 1)Create /etc/my.cnf file with the proper paths to mysql.sock.I even tried modifying mysql.server with vi directly. Modifying the php.ini was worthless. Nothing worked because MySQL wasn't starting, therefore it wasn't creating mysql.sock in the first place. Maybe you can point to the directory it is being created, and not the actual full file path i.e. not /tmp/mysql.sock but /tmp It was suggested but wasn't working because there was no mysql.sock because mysqld wasn't spawning.

以下是我尝试过的方法: 1)使用正确的 mysql.sock 路径创建 /etc/my.cnf 文件。我什至尝试直接用 vi 修改 mysql.server。修改 php.ini 毫无价值。没有任何效果,因为 MySQL 没有启动,因此它首先没有创建 mysql.sock。也许你可以指向它正在创建的目录,而不是实际的完整文件路径,即不是 /tmp/mysql.sock 而是 /tmp 建议但没有工作,因为没有 mysql.sock 因为没有 mysqld产卵。

2)Basedir and datadir modifications didn't work because there was no mysql.sock to point too.

2)Basedir 和 datadir 修改不起作用,因为也没有 mysql.sock 指向。

Why? Because the mysql daemon wasn't starting. Without anything to start mysqld and thereby create mysql.sock I was doomed. They are an important part of the solution but if you try them and still get errors, you will know why.

为什么?因为 mysql 守护进程没有启动。没有任何东西启动 mysqld 从而创建 mysql.sock 我注定要失败。它们是解决方案的重要组成部分,但如果您尝试使用它们但仍然出现错误,您就会知道原因。

3)sudo chown -R root:wheel /Library/StartupItems/MySQLCOM/

3)sudo chown -R root:wheel /Library/StartupItems/MySQLCOM/

didn't solve my problem. I ended up having that folder and all items set to root:wheel though in the end, because it was one of the many things recommended and its working. Maybe it could remain _mysql but wheel works.

没有解决我的问题。我最终将该文件夹和所有项目设置为 root:wheel ,但最终,因为它是推荐的众多东西之一并且它可以工作。也许它可以保留 _mysql 但轮子可以工作。

4)Copy mysql.sock from another machine.Doesn't work. I had searched and searched my new machine and couldn't find mysql.sock. I was using find / | grep mysql.sock because locate mysql wasn't finding anything. Besides I was trying so many different things it wasn't updating enough to find my new installs. I now like find much more than locate, even though you can update the locate db. Anyhow you can't copy mysql.sock, even if you tar it because its a 0 byte file.

4)从另一台机器复制mysql.sock。不起作用。我已经搜索并搜索了我的新机器,但找不到 mysql.sock。我正在使用 find / | grep mysql.sock 因为 locate mysql 没有找到任何东西。此外,我尝试了很多不同的东西,它的更新不足以找到我的新安装。我现在比 locate 更喜欢 find,即使您可以更新 locate db。无论如何你不能复制 mysql.sock,即使你因为它是一个 0 字节的文件而对它进行了 tar。

THE RESOLUTION:I finally stumbled onto the solution. I finally just typed mysqld from command line while I was in the proper bin directory. It said another process was running. _mysql was spawning a process that I could see in the Activity Monitor. I killed the active mysql process and when I typed mysqld again I found it was creating my mysql.sock file in the /private/tmp/mysql.sock

解决方案:我终于偶然发现了解决方案。当我在正确的 bin 目录中时,我终于从命令行输入了 mysqld 。它说另一个进程正在运行。_mysql 正在生成一个我可以在活动监视器中看到的进程。我杀死了活动的 mysql 进程,当我再次输入 mysqld 时,我发现它正在 /private/tmp/mysql.sock 中创建我的 mysql.sock 文件

The mysql pref pane wouldn't start the right process on login, so I just disabled that for being worthless. It wouldn't start mysql because no mysql.sock was being created.

mysql 首选项窗格不会在登录时启动正确的进程,所以我只是因为毫无价值而禁用了它。它不会启动 mysql,因为没有创建 mysql.sock。

By then I had figured out that mysqld creates mysql.sock. I then found /opt/local/mysql/ and typed "open bin" in the terminal window. This opened the directory with mysqld in it.

到那时我已经发现 mysqld 创建了 mysql.sock。然后我找到 /opt/local/mysql/ 并在终端窗口中输入“open bin”。这打开了包含 mysqld 的目录。

I went to login items in the system preferences in my account settings and dragged and dropped the mysqld file onto the startup items there. THAT worked. Finally!

我在帐户设置中的系统首选项中登录项目,然后将 mysqld 文件拖放到那里的启动项目上。那行得通。最后!

It works flawlessly because mysqld is starting up at login, which means mysql.sock is being created so no more errors about not being able to find mysql.sock.

它可以完美运行,因为 mysqld 在登录时启动,这意味着 mysql.sock 正在创建,因此不会再出现无法找到 mysql.sock 的错误。

回答by Matt Sephton

I'd guess that your iMac isn't 64-bit (you state in another thread it is an original white intel iMac). Try the 32-bit version of MySQL–it should install directly over the 64-bit version, I think.

我猜你的 iMac 不是 64 位的(你在另一个帖子中说它是原始的白色英特尔 iMac)。试试 32 位版本的 MySQL——我认为它应该直接安装在 64 位版本上。

How to tell if your Intel-based Mac has a 32-bit or 64-bit processor
http://support.apple.com/kb/HT3696

如何判断基于 Intel 的 Mac 是 32 位还是 64 位处理器
http://support.apple.com/kb/HT3696

回答by Palm

open Terminal

打开终端

cd /usr/local/mysql/support-files
sudo nano mysql.server

cd /usr/local/mysql/support-files
sudo nano mysql.server

Find the lines:

找到以下几行:

basedir=
datadir=

basedir=数据
目录=

change them to

将它们更改为

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

basedir=/usr/local/mysql
datadir=/usr/local/mysql/data

回答by DIONISIO GOMEZ

  1. Change the following to the file /usr/local/mysql/support-files/mysql.serverthe follow lines:

    basedir="/usr/local/mysql"
    
    datadir="/usr/local/mysql/data"
    

    and save it.

  2. In the file /etc/rc.commonadd the follow line at end: /usr/local/mysql/bin/mysqld_safe --user=mysql &
  1. 将以下内容更改为文件中的以下几 /usr/local/mysql/support-files/mysql.server行:

    basedir="/usr/local/mysql"
    
    datadir="/usr/local/mysql/data"
    

    并保存它。

  2. 在文件的末尾/etc/rc.common添加以下行: /usr/local/mysql/bin/mysqld_safe --user=mysql &

回答by Wyatt

Along with making sure you install the 64bit version, also check to make sure that the symbolic link of '/usr/local/mysql' is pointing to the correct version of your installation:

除了确保安装 64 位版本外,还要检查以确保“/usr/local/mysql”的符号链接指向正确的安装版本:

lrwxr-xr-x   1 root  wheel    27B Aug 29 01:24 mysql -> mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x   3 root  wheel   102B Aug 29 01:25 mysql-5.1.30-osx10.5-x86
drwxr-xr-x  11 root  wheel   374B Aug 29 15:59 mysql-5.1.37-osx10.5-x86_64
drwxr-xr-x  17 root  wheel   578B Jul 13 22:06 mysql-5.1.37-osx10.5-x86_64.old

Alos, I found that after my installation, even though I used the pkg file from MySQL various other libraries would not build against the installation. The solution was to follow the steps to build MySQL from source found here. You can manually start it as root with the command:

Alos,我发现安装后,即使我使用了 MySQL 中的 pkg 文件,其他各种库也不会针对安装进行构建。解决方案是按照从此处找到的源代码构建 MySQL 的步骤进行操作。您可以使用以下命令以 root 用户身份手动启动它:

/usr/loca/mysql/bin/mysqld_safe [whatever options you use]

Now ... to get the preference pane working I did the following:

现在......为了让偏好面板工作,我做了以下事情:

  1. Installed 64bit version of MySQL Server packet from mysql.com
  2. Moved the package from mysql-5.1.37-osx10.5-x86_64 to mysql-5.1.37-osx10.5-x86_64.old
  3. Did a manual compile and installation of MySQL as per these instructions
  4. Executed the following command:

    sudo cp -R /usr/local/mysql-5.1.37-osx10.5-x86_64.old/support-files /usr/local/mysql/.

  5. Opened up the MySQL Preference Pane and tada! it works

  1. 从 mysql.com 安装了 64 位版本的 MySQL 服务器数据包
  2. 将包从 mysql-5.1.37-osx10.5-x86_64 移动到 mysql-5.1.37-osx10.5-x86_64.old
  3. 按照这些说明手动编译和安装 MySQL
  4. 执行了以下命令:

    sudo cp -R /usr/local/mysql-5.1.37-osx10.5-x86_64.old/support-files /usr/local/mysql/.

  5. 打开 MySQL 首选项窗格和 tada!有用

回答by Jeremy L

Have you considered installing MacPorts 1.8.0 (release candidate), and keeping MySQL up-to-date that way? That will build MySQL for the architecture and OS that you're using, rather than installing a 10.5 version on 10.6.

您是否考虑过安装 MacPorts 1.8.0(候选版本),并以这种方式使 MySQL 保持最新?这将为您使用的体系结构和操作系统构建 MySQL,而不是在 10.6 上安装 10.5 版本。