不能在Mavericks上开始MySQL吗

时间:2021-11-11 00:09:36

I recently upgraded my Mac to Mavericks and am having trouble getting MySQL to work.

我最近升级了我的Mac电脑到Mavericks,并且很难让MySQL工作。

I removed my previous MySQL installation per instructions found on the web, then downloaded the DMG file and ran the installer - after which, I was able to get it running, but was not able to log in.

我删除了之前在web上找到的MySQL安装,然后下载了DMG文件并运行了安装程序——之后,我可以让它运行,但无法登录。

I noticed the installer created a /usr/local/mysql/ directory which points to /usr/local/mysql-5.6.19-osx10.7-x86_64

我注意到安装程序创建了一个/usr/local/mysql/目录,指向/usr/local/mysql-5.6.19-osx10.7-x86_64。

I then replaced the /usr/local/mysql-5.6.19-osx10.7-x86_64/data directory with the old data directory, and now I can't start MySQL.

然后,我将/usr/local/ sql-5.6.19-osx10.7-x86_64/data目录替换为旧的数据目录,现在我无法启动MySQL。

I get the error: "warning the /usr/local/mysql/data directory is not owned by the 'mysql' or '_mysql' user" and can no longer start MySQL.

我得到的错误是:“警告/usr/local/mysql/data目录不属于‘mysql’或‘_mysql’用户”,并且不能再启动mysql。

I tried to change permissions of the directory with the following without luck:

我试着改变目录的权限,但是没有成功,如下所示:

sudo chmod -R 777 /usr/local/mysql/

sudo chmod - r777 /usr/local/mysql/

sudo chmod -R 777 /usr/local/mysql-5.6.19-osx10.7-x86_64

sudo chmod - r777 /usr/local/mysql- 5.19 -osx10.7-x86_64

sudo chown -R mysql:mysql /usr/local/mysql/data

sudo chown -R mysql:mysql /usr/local/mysql/data

sudo chown -R mysql:mysql /usr/local/mysql/data

sudo chown -R mysql:mysql /usr/local/mysql/data

sudo chown -R _mysql /usr/local/var/mysql

sudo chown -R _mysql /usr/local/var/mysql。

chown: /usr/local/var/mysql: No such file or directory

chown: /usr/local/var/mysql:没有这样的文件或目录

sudo chmod -R o+rwx /usr/local/var/mysql

sudo chmod -R o+rwx /usr/local/var/mysql

chmod: /usr/local/var/mysql: No such file or directory

chmod: /usr/local/var/mysql:没有这样的文件或目录

I did modify the plist file and cnf files as described here:

我确实修改了plist文件和cnf文件,如下所述:

https://community.jboss.org/blogs/tedjones/2014/05/02/getting-mysql-up-and-running-after-upgrading-to-mavericks?_sscc=t

https://community.jboss.org/blogs/tedjones/2014/05/02/getting-mysql-up-and-running-after-upgrading-to-mavericks?_sscc=t

Not sure what else to do.

不知道还能做什么。

1 个解决方案

#1


4  

I was able to solve this problem. You just have to be meticulous when you run the install.

我能解决这个问题。当你运行安装的时候,你必须要一丝不苟。

Please note that upgrading from Mac OS 10.8 or older to Mavericks will cause MySQL to no longer run (in other words, "Are you sure you want to upgrade to Mavericks?")

请注意,从Mac OS 10.8或更老的版本升级到Mavericks将导致MySQL不再运行(换句话说,“您确定要升级到Mavericks吗?”)

With MySQL non-functional, I decided to reinstall MySQL and upgrade to the newest version.

由于MySQL的非功能性,我决定重新安装MySQL并升级到最新版本。

I followed the instructions in the link above with the following words of advice:

我按照以上连结的指示,提出以下建议:

  1. Backup your MySQL data directory before doing anything.

    在做任何事情之前备份MySQL数据目录。

    The MySQL data file is located in the /usr/local/mysql-5.6.19-osx10.7-x86_64/data directory (or similar, depending on what version you have installed).

    MySQL数据文件位于/usr/local/ MySQL - 5.19 -osx10.7-x86_64/data目录(或类似的目录,取决于您安装的版本)。

    BACK IT UP!

    支持它!

  2. Make sure you stop MySQL before installing the upgraded version.

    在安装升级版本之前,请确保停止MySQL。

    If your plist file has keepalive set to True, every time you try to quit MySQL, it will quit (or will appear to quit) but then immediately restart.

    如果你的plist文件的keepalive设置为True,那么每次你尝试退出MySQL时,它都会退出(或者看起来会退出),然后立即重新启动。

    If you want to use the Preference Pane to start and stop MySQL, make sure you set keepalive in the .plist file to false, otherwise the Preference Pane won't work.

    如果您想要使用“首选”窗格启动和停止MySQL,请确保在.plist文件中设置keepalive,否则“Preference”窗格将不起作用。

    I tried to kill the plist process after making the change, but it wouldn't work. I just restarted my Mac and from that point on, I was able to start and stop MySQL from Terminal or the Preference Pane when needed.

    在做了更改之后,我试图终止plist进程,但它不起作用。我刚刚重启了我的Mac,从那以后,我就可以在需要的时候从终端或首选项面板上启动和停止MySQL。

    Occasionally, the Preference Pane failed to start/stop MySQL. In that case, I would enter the start/stop command in Terminal and it worked.

    有时,首选项窗格未能启动/停止MySQL。在这种情况下,我将在终端中输入start/stop命令,然后它就工作了。

    Start MySQL:

    MySQL开始:

    sudo /usr/local/mysql/support-files/mysql.server start
    

    Stop MySQL:

    停止MySQL:

    sudo /usr/local/mysql/support-files/mysql.server stop
    
  3. Download the .dmg file from MySQL and run the installer.

    从MySQL下载.dmg文件并运行安装程序。

    I did try downloading the .tar file, and it may have worked - but on my second try, I chose the .dmg file and everything went smoothly.

    我确实下载了。tar文件,它可能已经工作了-但是在我的第二次尝试中,我选择了。dmg文件,一切都很顺利。

    If you try to start MySQL at this point, it should run without a problem.

    如果您试图在此时启动MySQL,那么它运行时应该没有问题。

    Remember, since at this point you have a clean install of MySQL, you can log in with the username 'root' and password 'no password' (leave password blank).

    请记住,因为在这一点上,您有一个干净的MySQL安装,您可以使用用户名“root”和密码“no password”(留下密码空白)登录。

    Please note that if you start MySQL from the terminal, you will get more information than trying from the Preference Pane, so if you are having difficulty, make sure you stop and start MySQL from Terminal. You will get some error messages that you use to troubleshoot the problem.

    请注意,如果从终端启动MySQL,您将获得比从首选项窗格中尝试更多的信息,因此如果遇到困难,请确保从终端停止并启动MySQL。您将得到一些错误消息,您将使用这些消息对问题进行故障排除。

  4. You can modify the .cnf and .plist files as mentioned in the installer instructions above (as long as you stop MySQL before making any changes).

    您可以在上面的安装说明中修改.cnf和.plist文件(只要您在做任何更改之前停止MySQL)。

    Typically you would copy and paste the information from the web page (mentioned above) into the .cnf file. It is pretty straight forward, but double and triple check that the copy and paste did not miss a character or two. This happened to me while pasting the code into the .cnf file (the first two characters were missing) and it took me hours to figure this out - which prevented MySQL from starting.

    通常,您将从web页面(上面提到的)复制并粘贴到.cnf文件中。这是相当直接的,但双重和三重检查,复制和粘贴没有漏掉一个或两个字符。这发生在我把代码粘贴到.cnf文件(前两个字符丢失)的时候,我花了好几个小时才弄明白这一点——这阻止了MySQL启动。

    If the changes to the .cnf or .plist file don't seem to take effect, restart the Mac (easier than restarting the process).

    如果.cnf或.plist文件的更改没有生效,那么重新启动Mac(比重新启动更容易)。

  5. Moving your data.

    移动你的数据。

    My install created a /usr/local/mysql/ alias or symbolic link to the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64 directory.

    我的安装创建了/usr/local/mysql/ alias或符号链接到/usr/local/mysql/mysql- 5.19 -osx10.7-x86_64目录。

    The /usr/local/mysql/data directory (which is actually the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64/data directory - remember, it's a symbolic link) is where your data resides.

    数据目录(它实际上是/usr/local/mysql/mysql- 5.19 -osx10.7-x86_64/data目录——记住,它是一个符号链接)是数据驻留的地方。

    You want a backup of your previous data directory. If you forgot to back that up before running the installer, and you have a Time Machine backup, you can retrieve it.

    您希望备份以前的数据目录。如果您在运行安装程序之前忘记备份,并且您有一个时间机器备份,那么您可以检索它。

    The easiest way to do this is to open the /usr/local/ directory (From the Finder and choose "Go to Folder" from the Go menu) and with the /usr/local/ directory open in the Finder, choose Enter Time Machine from the Time Machine menu. Go back to the last known date that has your previous MySQL installation. Find the folder of your previous MySQL install and open the data directory.

    最简单的方法是打开/usr/local/目录(从查找程序中,从Go菜单中选择“Go to Folder”),并在查找程序中打开/usr/local/目录,从Time Machine菜单中选择Enter Time Machine。回到上次MySQL安装的日期。找到之前MySQL安装的文件夹并打开数据目录。

    You have to choose all the files from the exact same point in time. You can't choose one data folder from one day and one data folder from another (I actually did this and spent a lot of time trying to figure out why one of my data tables were visible in Sequel Pro but wouldn't work). After a while, I finally figured out that everything absolutely has to be from the exact same point in time.

    你必须从相同的时间点上选择所有的文件。您不能从一天中选择一个数据文件夹,从一天中选择一个数据文件夹,从另一个数据文件夹中选择一个数据文件夹(我确实这么做了,并花了大量时间试图弄明白为什么在Sequel Pro中我的一个数据表是可见的,但不能工作)。过了一会儿,我终于明白了,所有的一切都必须在同一时间点上。

    You can copy files while in Time Machine by right-clicking on them. Choose all your data folders (with the .ibd and .frm files in them) PLUS all the ib_logfiles (ib_logfile0, ib_logfile1), auto.cnf, and the .pid file. Basically copy everything in the mysql data folder EXCEPT the mysql, performance_schema, and test directories.

    您可以在Time Machine上通过右键单击文件复制文件。选择所有数据文件夹(其中包含.ibd和.frm文件)以及所有ib_logfiles (ib_logfile0、ib_logfile1)、auto.cnf和.pid文件。基本上复制mysql数据文件夹中的所有内容,除了mysql、performance_schema和测试目录。

    Exit Time Machine.

    退出时间机器。

    Make sure MySQL is stopped and then paste the data files into the /usr/local/mysql/data directory.

    确保停止MySQL,然后将数据文件粘贴到/usr/local/mysql/data目录。

  6. Set the privileges to the data directory.

    将权限设置为数据目录。

    In Terminal, enter:

    在终端,输入:

    sudo chown -R mysql:mysql /usr/local/mysql/data
    

    Make sure NOT to use the chmod 777 command as some people online said it can damage things.

    不要使用chmod 777命令,因为有些人在网上说它会损坏东西。

  7. Now, start MySQL and you should have your data files from your previous MySQL install intact and functional. In addition, I did not have to reset any passwords for Sequel Pro. The Sequel Pro settings saved before the Mavericks upgrade worked.

    现在,开始MySQL,你应该有你以前的MySQL安装完整和功能的数据文件。另外,我不需要重置任何Sequel Pro的密码。在小牛队升级之前,他们已经保存了续集。

#1


4  

I was able to solve this problem. You just have to be meticulous when you run the install.

我能解决这个问题。当你运行安装的时候,你必须要一丝不苟。

Please note that upgrading from Mac OS 10.8 or older to Mavericks will cause MySQL to no longer run (in other words, "Are you sure you want to upgrade to Mavericks?")

请注意,从Mac OS 10.8或更老的版本升级到Mavericks将导致MySQL不再运行(换句话说,“您确定要升级到Mavericks吗?”)

With MySQL non-functional, I decided to reinstall MySQL and upgrade to the newest version.

由于MySQL的非功能性,我决定重新安装MySQL并升级到最新版本。

I followed the instructions in the link above with the following words of advice:

我按照以上连结的指示,提出以下建议:

  1. Backup your MySQL data directory before doing anything.

    在做任何事情之前备份MySQL数据目录。

    The MySQL data file is located in the /usr/local/mysql-5.6.19-osx10.7-x86_64/data directory (or similar, depending on what version you have installed).

    MySQL数据文件位于/usr/local/ MySQL - 5.19 -osx10.7-x86_64/data目录(或类似的目录,取决于您安装的版本)。

    BACK IT UP!

    支持它!

  2. Make sure you stop MySQL before installing the upgraded version.

    在安装升级版本之前,请确保停止MySQL。

    If your plist file has keepalive set to True, every time you try to quit MySQL, it will quit (or will appear to quit) but then immediately restart.

    如果你的plist文件的keepalive设置为True,那么每次你尝试退出MySQL时,它都会退出(或者看起来会退出),然后立即重新启动。

    If you want to use the Preference Pane to start and stop MySQL, make sure you set keepalive in the .plist file to false, otherwise the Preference Pane won't work.

    如果您想要使用“首选”窗格启动和停止MySQL,请确保在.plist文件中设置keepalive,否则“Preference”窗格将不起作用。

    I tried to kill the plist process after making the change, but it wouldn't work. I just restarted my Mac and from that point on, I was able to start and stop MySQL from Terminal or the Preference Pane when needed.

    在做了更改之后,我试图终止plist进程,但它不起作用。我刚刚重启了我的Mac,从那以后,我就可以在需要的时候从终端或首选项面板上启动和停止MySQL。

    Occasionally, the Preference Pane failed to start/stop MySQL. In that case, I would enter the start/stop command in Terminal and it worked.

    有时,首选项窗格未能启动/停止MySQL。在这种情况下,我将在终端中输入start/stop命令,然后它就工作了。

    Start MySQL:

    MySQL开始:

    sudo /usr/local/mysql/support-files/mysql.server start
    

    Stop MySQL:

    停止MySQL:

    sudo /usr/local/mysql/support-files/mysql.server stop
    
  3. Download the .dmg file from MySQL and run the installer.

    从MySQL下载.dmg文件并运行安装程序。

    I did try downloading the .tar file, and it may have worked - but on my second try, I chose the .dmg file and everything went smoothly.

    我确实下载了。tar文件,它可能已经工作了-但是在我的第二次尝试中,我选择了。dmg文件,一切都很顺利。

    If you try to start MySQL at this point, it should run without a problem.

    如果您试图在此时启动MySQL,那么它运行时应该没有问题。

    Remember, since at this point you have a clean install of MySQL, you can log in with the username 'root' and password 'no password' (leave password blank).

    请记住,因为在这一点上,您有一个干净的MySQL安装,您可以使用用户名“root”和密码“no password”(留下密码空白)登录。

    Please note that if you start MySQL from the terminal, you will get more information than trying from the Preference Pane, so if you are having difficulty, make sure you stop and start MySQL from Terminal. You will get some error messages that you use to troubleshoot the problem.

    请注意,如果从终端启动MySQL,您将获得比从首选项窗格中尝试更多的信息,因此如果遇到困难,请确保从终端停止并启动MySQL。您将得到一些错误消息,您将使用这些消息对问题进行故障排除。

  4. You can modify the .cnf and .plist files as mentioned in the installer instructions above (as long as you stop MySQL before making any changes).

    您可以在上面的安装说明中修改.cnf和.plist文件(只要您在做任何更改之前停止MySQL)。

    Typically you would copy and paste the information from the web page (mentioned above) into the .cnf file. It is pretty straight forward, but double and triple check that the copy and paste did not miss a character or two. This happened to me while pasting the code into the .cnf file (the first two characters were missing) and it took me hours to figure this out - which prevented MySQL from starting.

    通常,您将从web页面(上面提到的)复制并粘贴到.cnf文件中。这是相当直接的,但双重和三重检查,复制和粘贴没有漏掉一个或两个字符。这发生在我把代码粘贴到.cnf文件(前两个字符丢失)的时候,我花了好几个小时才弄明白这一点——这阻止了MySQL启动。

    If the changes to the .cnf or .plist file don't seem to take effect, restart the Mac (easier than restarting the process).

    如果.cnf或.plist文件的更改没有生效,那么重新启动Mac(比重新启动更容易)。

  5. Moving your data.

    移动你的数据。

    My install created a /usr/local/mysql/ alias or symbolic link to the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64 directory.

    我的安装创建了/usr/local/mysql/ alias或符号链接到/usr/local/mysql/mysql- 5.19 -osx10.7-x86_64目录。

    The /usr/local/mysql/data directory (which is actually the /usr/local/mysql/mysql-5.6.19-osx10.7-x86_64/data directory - remember, it's a symbolic link) is where your data resides.

    数据目录(它实际上是/usr/local/mysql/mysql- 5.19 -osx10.7-x86_64/data目录——记住,它是一个符号链接)是数据驻留的地方。

    You want a backup of your previous data directory. If you forgot to back that up before running the installer, and you have a Time Machine backup, you can retrieve it.

    您希望备份以前的数据目录。如果您在运行安装程序之前忘记备份,并且您有一个时间机器备份,那么您可以检索它。

    The easiest way to do this is to open the /usr/local/ directory (From the Finder and choose "Go to Folder" from the Go menu) and with the /usr/local/ directory open in the Finder, choose Enter Time Machine from the Time Machine menu. Go back to the last known date that has your previous MySQL installation. Find the folder of your previous MySQL install and open the data directory.

    最简单的方法是打开/usr/local/目录(从查找程序中,从Go菜单中选择“Go to Folder”),并在查找程序中打开/usr/local/目录,从Time Machine菜单中选择Enter Time Machine。回到上次MySQL安装的日期。找到之前MySQL安装的文件夹并打开数据目录。

    You have to choose all the files from the exact same point in time. You can't choose one data folder from one day and one data folder from another (I actually did this and spent a lot of time trying to figure out why one of my data tables were visible in Sequel Pro but wouldn't work). After a while, I finally figured out that everything absolutely has to be from the exact same point in time.

    你必须从相同的时间点上选择所有的文件。您不能从一天中选择一个数据文件夹,从一天中选择一个数据文件夹,从另一个数据文件夹中选择一个数据文件夹(我确实这么做了,并花了大量时间试图弄明白为什么在Sequel Pro中我的一个数据表是可见的,但不能工作)。过了一会儿,我终于明白了,所有的一切都必须在同一时间点上。

    You can copy files while in Time Machine by right-clicking on them. Choose all your data folders (with the .ibd and .frm files in them) PLUS all the ib_logfiles (ib_logfile0, ib_logfile1), auto.cnf, and the .pid file. Basically copy everything in the mysql data folder EXCEPT the mysql, performance_schema, and test directories.

    您可以在Time Machine上通过右键单击文件复制文件。选择所有数据文件夹(其中包含.ibd和.frm文件)以及所有ib_logfiles (ib_logfile0、ib_logfile1)、auto.cnf和.pid文件。基本上复制mysql数据文件夹中的所有内容,除了mysql、performance_schema和测试目录。

    Exit Time Machine.

    退出时间机器。

    Make sure MySQL is stopped and then paste the data files into the /usr/local/mysql/data directory.

    确保停止MySQL,然后将数据文件粘贴到/usr/local/mysql/data目录。

  6. Set the privileges to the data directory.

    将权限设置为数据目录。

    In Terminal, enter:

    在终端,输入:

    sudo chown -R mysql:mysql /usr/local/mysql/data
    

    Make sure NOT to use the chmod 777 command as some people online said it can damage things.

    不要使用chmod 777命令,因为有些人在网上说它会损坏东西。

  7. Now, start MySQL and you should have your data files from your previous MySQL install intact and functional. In addition, I did not have to reset any passwords for Sequel Pro. The Sequel Pro settings saved before the Mavericks upgrade worked.

    现在,开始MySQL,你应该有你以前的MySQL安装完整和功能的数据文件。另外,我不需要重置任何Sequel Pro的密码。在小牛队升级之前,他们已经保存了续集。