库未加载:尝试运行“rails 服务器”时出现 libmysqlclient.16.dylib 错误;在 OS X 10.6 上使用 mysql2 gem

发布于 2024-10-09 18:20:08 字数 2280 浏览 9 评论 0原文

我已经为此苦苦挣扎了一段时间。

我已经在我的 Snow Leopard 机器上安装了 Rails 3、gem、mysql。一切都很顺利,直到我创建了我的第一个项目并尝试运行

rails server

运行后,我得到:

jontybrook$ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
    from /Users/jontybrook/Dropbox/CODING/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6
jontybrook$ 

据我所知,问题出在 mysql2 gem 上。 MySQL 似乎运行良好,我的 Gemfile 引用了 mysql2,我的 database.yml 文件似乎也正常。

错误提到

Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

And Yet

jontybrook$ cd /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2
jontybrook$ ls
client.rb   em.rb       error.rb      mysql2.bundle result.rb

MySQL2.bundle is there!?

如果我使用旧的 mysql gem,WEBrick 启动正常。但这并不理想,不是吗?

我已经尝试了谷歌可以给我的一切!非常感谢任何帮助。

I've been struggling with this for some time.

I've installed Rails 3, gem, mysql on my Snow Leopard machine. All was going well until I created my first project and tried to run

rails server

Upon running this I get:

jontybrook$ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2.rb:7
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:62:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:51:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler.rb:112:in `require'
    from /Users/jontybrook/Dropbox/CODING/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6
jontybrook$ 

As far as I can tell the problem is with the mysql2 gem. MySQL seems to be running fine and my Gemfile references mysql2, my database.yml file seems ok also.

The error mentions

Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

And yet

jontybrook$ cd /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2
jontybrook$ ls
client.rb   em.rb       error.rb      mysql2.bundle result.rb

MySQL2.bundle is there!?

If I use the old mysql gem, WEBrick boots fine. But that's not ideal, is it?

I've tried everything google can give me! Any help much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(24

神经大条 2024-10-16 18:20:08

我从来没有能够得到任何对我有用的答案,但这是我用来让它为我工作的命令。这样你就不需要每次更新mysql时都使用install_name_tool

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

I was never able to get any of these answers to work for me, but this is the command that I used to make it work for me. This way you don't need to use install_name_tool every time you update your mysql

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib
橙味迷妹 2024-10-16 18:20:08

我最终解决了这个问题!

我在 RVM 下重新安装了 Ruby 和 Rails。我使用的是 Ruby 版本 1.9.2-p136。

在rvm下重新安装后,这个错误仍然存​​在。

最后解决这个问题的神奇命令是:

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.2-p136/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

I have solved this, eventually!

I re-installed Ruby and Rails under RVM. I'm using Ruby version 1.9.2-p136.

After re-installing under rvm, this error was still present.

In the end the magic command that solved it was:

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.2-p136/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
迷迭香的记忆 2024-10-16 18:20:08

此修复对我来说非常有效:

将以下内容添加到您的 ~/.profile

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

http://www.rickwargo.com/2010/12/16/installing-mysql-5-5-on- os-x-10-6-snow-leopard-and-rails-3/

This fix worked very well for me:

Add the following to to your ~/.profile

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

http://www.rickwargo.com/2010/12/16/installing-mysql-5-5-on-os-x-10-6-snow-leopard-and-rails-3/

故事和酒 2024-10-16 18:20:08

对我来说,这只是因为我升级了 mysql,但没有更新 mysql2 gem - 重新安装 gem 将修复它...

gem pristine mysql2

For me this was just because I had upgraded mysql but hadn't updated the mysql2 gem - a reinstall of the gem will fix it...

gem pristine mysql2

我乃一代侩神 2024-10-16 18:20:08

我有同样的问题。看起来无法找到 libmysqlclient 库。对我有用的临时修复如下:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

我不确定配置在哪里指定加载路径或它的设置是什么,但我的 mysql 安装似乎不在其中。如果我找到更永久的解决方案,我会再次发布。

编辑:
实际上 此修复似乎可以更准确地解决该问题。

I have the same issue. It looks like it's unable to find the libmysqlclient library. A temporary fix that has worked for me is the following:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/

I am not sure where the config is specifying the load path or what it's set to but my mysql install did not appear to be in it. I'll post again if I find a more permanent solution.

Edit:
Actually this fix appears to more accurately address the problem.

唐婉 2024-10-16 18:20:08

将以下内容添加到您的 ~/.bash_profile 中:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

这对我有用

Add the below to your ~/.bash_profile:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH

This worked for me

若水微香 2024-10-16 18:20:08

在 OSX El Capitan 更新中,当您执行此操作时:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

它会抛出类似的错误

ln: /usr/lib/libmysqlclient.18.dylib: Operation not permitted

因此为了避免这种情况,您可以做的是首先使用命令找到 libmysqlclient.18.dylib

User$ locate libmysqlclient.18.dylib

在我的情况下它返回 /usr/local/mysql-5.5.24-osx10.5-x86_64/lib/libmysqlclient.18.dylib

因此,我们将创建指向 的符号链接,而不是 usr/lib/ usr/local/lib/ 像这样:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

更多详细信息:https://forums.developer.apple.com/线程/7935

In OSX El Capitan update when you do this:

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

it throws an error like

ln: /usr/lib/libmysqlclient.18.dylib: Operation not permitted

So to avoid this, what you can do is first locate libmysqlclient.18.dylib using the command

User$ locate libmysqlclient.18.dylib

In my case it returned /usr/local/mysql-5.5.24-osx10.5-x86_64/lib/libmysqlclient.18.dylib

So instead of usr/lib/ we will create symlink to usr/local/lib/ like this :

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/local/lib/libmysqlclient.18.dylib

More details : https://forums.developer.apple.com/thread/7935

葵雨 2024-10-16 18:20:08

以下几行对我有用。我使用的是 mac 10.7.2 。

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

following lines works for me. I am using mac 10.7.2 .

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

红焚 2024-10-16 18:20:08

刚刚遇到这个问题。我所要做的就是卸载 mysql2 gem 并重新安装它。希望这对其他人有用

Just ran into this problem. All I had to do is uninstall mysql2 gem and reinstall it. Hope this works for other people

情深缘浅 2024-10-16 18:20:08

这就是它对我的作用:

我运行了以下命令
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/ mysql2.bundle

我的环境:
$ 轨道 -v
Rails 3.0.6

$ mysql --版本
mysql Ver 14.14 Distrib 5.5.11,适用于 osx10.6 (i386),使用 readline 5.1

$ ruby​​ -v
ruby 1.9.2p180(2011-02-18 修订版 30909)[x86_64-darwin10.7.0]

希望这对某人有帮助。

This is how it worked for me:

I ran the below command
sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql/lib/libmysqlclient.18.dylib ~/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle

My environments:
$ rails -v
Rails 3.0.6

$ mysql --version
mysql Ver 14.14 Distrib 5.5.11, for osx10.6 (i386) using readline 5.1

$ ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.7.0]

Hope this helps someone.

入画浅相思 2024-10-16 18:20:08

谢谢,奥加波!导出该别名对我有用,然后我按照链接进行操作,在我的情况下,mysql2.bundle位于 /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle 中,所以我调整了 install_name_tool 来修改该捆绑包而不是 ~/.rvm 中的捆绑包,并使其按照应有的方式工作。

所以现在:

   $ otool -L /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle 
    /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:
        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7)
        /usr/local/mysql/lib/libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

Thanks, Ogapo! Exporting that alias worked for me, and then I followed the link, and in my case the mysql2.bundle was up in /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle so I adjusted the install_name_tool to modify that bundle rather than one in ~/.rvm and got that working the way it should be done.

So now:

   $ otool -L /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle 
    /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:
        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7)
        /usr/local/mysql/lib/libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
扎心 2024-10-16 18:20:08

嗨,它从推荐的链接对我有用 来自 Fredy Andersen

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql /lib/libmysqlclient.16.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

只需更改为我的 mysql 版本,在命令中,
谢谢

hi it worked for me from the recommended link from Fredy Andersen

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql /lib/libmysqlclient.16.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

just had to change to my version of mysql, in the command,
thanks

挽你眉间 2024-10-16 18:20:08

我通过删除当前项目的 gemset 并重新创建它并重新运行捆绑安装来解决这个问题。我认为是由于安装了较新版本的 mysql 造成的。

I solved this problem by deleting my gemset for my current project and recreating it and rerunning bundle install. I think I caused it by installing a newer version of mysql.

清风无影 2024-10-16 18:20:08

我在使用 Django 时遇到了这个问题,我使用 brew 安装了很多开源程序,并且我需要执行以下操作,因为我使用 brew 安装 mysql

sudo ln -s /usr/local/Cellar/mysql/5.5.20/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

请务必替换为您的库版本!

I had this issue when working with Django, I use brew to install a lot of my Open Source programs and I needed to do the following since I used brew to install mysql:

sudo ln -s /usr/local/Cellar/mysql/5.5.20/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

Be sure to replace with your version of the libraries!

画中仙 2024-10-16 18:20:08

bundle install mysql --force 帮助了我。它重新安装了由于 brew uninstall mysql 而消失的依赖项。

bundle install mysql --force helped me. It reinstalled dependencies which ware gone as a result of brew uninstall mysql.

柳絮泡泡 2024-10-16 18:20:08

乔蒂,我也在为此苦苦挣扎。

我认为这里有一个线索:

otool -L /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7)
    libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

注意到 dylib 的路径是,呃,相当短?

我试图找出 gem 安装指令离开 dylib 路径的位置,但进展缓慢,因为我自己从未构建过 gem。

如果我找到更多,我会发布更多!

Jonty, I'm struggling with this too.

I think there's a clue in here:

otool -L /Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

/Library/Ruby/Gems/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle:
    /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/libruby.1.dylib (compatibility version 1.8.0, current version 1.8.7)
    libmysqlclient.16.dylib (compatibility version 16.0.0, current version 16.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)

Notice the path to the dylib is, uh, rather short?

I'm trying to figure out where the gem install instructions are leaving off the dylib path, but it's slow going as I have never built a gem myself.

I'll post more if I find more!

明月松间行 2024-10-16 18:20:08

几天前我也遇到过同样的问题。我最终设法解决了它。我不太确定是怎么做的,但无论如何我都会告诉你我做了什么。也许它会对你有帮助。

我首先下载了 RVM。如果您尚未使用它,我强烈建议您这样做。它基本上为 Ruby、RoR 和 RubyGems 的新单独安装创建了一个沙箱。事实上,您可以同时进行多个安装并立即切换到另一个。它就像一个魅力。

为什么这有用?因为您不应该弄乱 OS X 中默认的 Ruby 安装。系统依赖于它。最好只保留默认的 Ruby 和 RoR 安装,并使用 RVM 创建一个新的安装,您可以将其用于您自己的开发。

创建单独的 Ruby 安装后,我只安装了 RoR、RubyGems 和 mysql,它就可以工作了。有关我采取的具体步骤,请参阅我的问题:安装 Rails、MySQL 等。一切都会出错

再次:我不确定这是否能解决您的问题。但它确实对我有用,并且无论如何,强烈推荐使用 RVM。

I've had this exact same problem a few days ago. I eventually managed to solve it. I'm not quite sure how, but I'll tell you what I did anyway. Maybe it'll help you.

I started by downloading RVM. If you aren't using it yet, I highly recommend doing so. It basically creates a sandbox for a new separate installation of Ruby, RoR and RubyGems. In fact, you can have multiple installations simultaneously and instantly switch to one other. It works like a charm.

Why is this useful? Because you shouldn't mess with the default Ruby installation in OS X. The system depends on it. It's best to just leave the default Ruby and RoR installation alone and create a new one using RVM that you can use for your own development.

Once I created my separate Ruby installation, I just installed RoR, RubyGems and mysql, and it worked. For the exact steps I took, see my question: Installing Rails, MySQL, etc. everything goes wrong

Again: I don't know for certain this will solve your problem. But it certainly did the trick for me, and in any case using RVM is highly recommendable.

○闲身 2024-10-16 18:20:08

我仍然发现,使用上面的解决方案,它无法(例如)与 TextMate 的 Rails 插件一起使用。我遇到了类似的错误(检索数据库架构时)。

那么所做的是,打开终端:

cd /usr/local/lib
sudo ln -s ../mysql-5.5.8-osx10.6-x86_64/lib/libmysqlclient.16.dylib .

mysql-5.5.8-osx10.6-x86_64 替换为您自己的路径(或 mysql)。

这将创建一个指向库的符号链接,现在 Rails 从命令行运行,以及 TextMate 插件(如 ruby​​-on-rails-tmbundle)。

需要明确的是:这也修复了启动 Rails 服务器时出现的错误。

I still found that with the solutions above, it didn't work (for example) with the Rails plugin for TextMate. I got a similar error (when retrieving the database schema).

So what did is, open terminal:

cd /usr/local/lib
sudo ln -s ../mysql-5.5.8-osx10.6-x86_64/lib/libmysqlclient.16.dylib .

Replace mysql-5.5.8-osx10.6-x86_64 with your own path (or mysql).

This makes a symbol link to the lib, now rails runs from the command line, as-well as TextMate plugin(s) like ruby-on-rails-tmbundle.

To be clear: this also fixes the error you get when starting rails server.

红尘作伴 2024-10-16 18:20:08

这通常发生在升级 mysql 时。在旧 mysql 库上构建的已安装的 mysql2 gem 无法与新库一起使用。只需要重新安装即可。

使用gem uninstall mysql2卸载mysql2。然后使用gem install mysql2安装它

This usually happen when you upgrade mysql. The installed mysql2 gem which was built on the old mysql libs cannot work with new libs. Just need to reinstall it.

Uninstall mysql2 with gem uninstall mysql2. Then install it with gem install mysql2

梦途 2024-10-16 18:20:08

我通过在包含以下内容的项目文件夹中创建 .rvmrc 文件解决了这个问题:

rvm use <yourrubie>

然后输入我的项目路径

cd ~/myprojectpath

,然后运行

bundle install

I've resolved it by creating .rvmrc file in my project folder containg:

rvm use <yourrubie>

then entering my project path

cd ~/myprojectpath

then I run

bundle install
蝶舞 2024-10-16 18:20:08

我的luvlss命令版本:

Mac OSX 10.10.5

MySQL 5.6.27

Passenger 5.0.21

sudo ln -s /usr/local/mysql-5.6.27-osx10.8-x86_64/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

如果您像我一样尝试很多不同的链接,请使用以下命令进行一些清理:

sudo unlink /usr/lib/libmysqlclient.18.dylib

My version of luvlss's command:

Mac OSX 10.10.5

MySQL 5.6.27

Passenger 5.0.21

sudo ln -s /usr/local/mysql-5.6.27-osx10.8-x86_64/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib

If you're trying lots of different links, like I did, do some clean-up with:

sudo unlink /usr/lib/libmysqlclient.18.dylib

我不会写诗 2024-10-16 18:20:08

打开终端并运行以下命令:

export PATH=$PATH:/usr/local/mysql/bin

它应该可以工作。

Open a Terminal and run the following:

export PATH=$PATH:/usr/local/mysql/bin

It should work.

白馒头 2024-10-16 18:20:08

如果您使用 OSX 并使用 brew 安装了 mysql,您可以:

brew link mysql

如果您遇到版本问题(我运行 mysql 5.7,而我的 gem 需要 5.6.25),您可以

brew unlink mysql
brew switch mysql 5.6.25

If you're using OSX and installed mysql using brew, you can:

brew link mysql

If you're having trouble with the version (I had mysql 5.7 running while my gem required 5.6.25), you can

brew unlink mysql
brew switch mysql 5.6.25
素手挽清风 2024-10-16 18:20:08

对我来说,我必须手动卸载 mysql

brew uninstall mysql
rm -rf /usr/local/var/mysql
brew install mysql

For me I had to manually uninstall mysql

brew uninstall mysql
rm -rf /usr/local/var/mysql
brew install mysql
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文