无法在 Mac OS X 上安装 MySQL

2023-12-01

我遇到了这个问题中描述的确切问题:MYSQL安装问题。不幸的是,没有一个答案对我有帮助(并且它已关闭)。

我尝试学习 Ruby on Rails,但没有让 MySQL 工作(所以它与编程相关)。

我输入:rake db:create并得到:

!!!The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

(See full trace by running task with --trace)
HD-Auckland:shoutbox max$ gem install mysql
WARNING:  Installing to ~/.gem since /Library/Ruby/Gems/1.8 and
      /usr/bin aren't both writable.
WARNING:  You don't have /Users/max/.gem/ruby/1.8/bin in your PATH,
      gem executables will not run.
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Gem files will remain installed in /Users/max/.gem/ruby/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Users/max/.gem/ruby/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

正如它告诉我的那样,我尝试过sudo gem install mysql并得到:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

/opt/local/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/opt/local/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mlib
    --without-mlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-zlib
    --without-zlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-socketlib
    --without-socketlib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-nsllib
    --without-nsllib
    --with-mysqlclientlib
    --without-mysqlclientlib
    --with-mygcclib
    --without-mygcclib
    --with-mysqlclientlib
    --without-mysqlclientlib


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

我也尝试过这个命令sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config并得到同样的错误!

我能做些什么?我只想将我的数据库迁移到 MySQL 服务器!

谢谢你的帮助,梅克斯

Update:

感谢大家的热烈响应!是的,我在雪豹上。 我从这里下载了mysqlhttp://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg并安装了它。 然后我按照 Hivelogic 的指南进行 mysql 安装。

当我现在输入:sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_configor sudo gem istall mysql or sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql

我会得到:

Building native extensions.  This could take a while...
fotoSuccessfully installed mysql-2.8.1
1 gem installed
Installing ri documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate
Installing RDoc documentation for mysql-2.8.1...

No definition for next_result

No definition for field_name

No definition for field_table

No definition for field_def

No definition for field_type

No definition for field_length

No definition for field_max_length

No definition for field_flags

No definition for field_decimals

No definition for time_inspect

No definition for time_to_s

No definition for time_get_year

No definition for time_get_month

No definition for time_get_day

No definition for time_get_hour

No definition for time_get_minute

No definition for time_get_second

No definition for time_get_neg

No definition for time_get_second_part

No definition for time_set_year

No definition for time_set_month

No definition for time_set_day

No definition for time_set_hour

No definition for time_set_minute

No definition for time_set_second

No definition for time_set_neg

No definition for time_set_second_part

No definition for time_equal

No definition for error_errno

No definition for error_sqlstate

并在做rake db:create最终结果是:

(in /Users/max/rails/shoutbox)
!!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql.
rake aborted!
no such file to load -- mysql

(See full trace by running task with --trace)

由于某种原因(也许是因为我正在使用 ruby​​gems 1.3.7 或安装 mysql-2.8.1)

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

对我来说不起作用,所以在查看了 gems/mysql-2.8.1/ext/mysql_api/extconf.rb 之后,我发现 extconf.rb 在 mysql_config 的 PATH 中查找,所以我尝试了

export PATH=$PATH:/usr/local/mysql/bin
sudo gem install mysql

并完成了工作

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

无法在 Mac OS X 上安装 MySQL 的相关文章

随机推荐

  • 无法将 TextMeshPro 文本获取到 Unity 中的变量槽

    using TMPro public TextMeshPro livesText public TextMeshPro scoreText 我无法将文本从层次结构拖动到检查器中的变量槽 为什么会这样 请帮忙 你似乎在谈论一个TextMesh
  • Swift 3.0 - 用手指在 imageView 上绘图

    我一直致力于使用 swift 3 0 在图像视图上绘制红线 并遇到了一些问题 正如您可能猜到的那样 我正在使用堆栈溢出中的一些代码来帮助我进行第一次初步尝试 但遇到了一个奇怪的错误 当我在图像视图上拖动手指时 它确实绘制了一条红线 但对于每
  • currentUser() 不是工作类型,为什么我看到表达式的计算结果不是函数,因此无法调用它

    我是 Flutter 的新手 我正在开发一个简单的身份验证应用程序 当我注册时 我应该导航到聊天屏幕 并且我想获取当前用户 但是当我调用 FireBaseAuth instance currentUser 时 我得到了一个异常 表达式的计算
  • 获取传递给函数的所有参数和值

    我有一个Python函数 fetch data 它会访问远程 API 获取一些数据 然后将其包装在响应对象中返回 它看起来有点像下面这样 def fetch data self foo bar baz kwargs response Res
  • Google Apps 脚本的 V8 运行时 [重复]

    这个问题在这里已经有答案了 上周谷歌发布了新的Runtime 谁知道使用哪个版本的 V8 或 ECMAScript As per 将脚本迁移到 v8 文档 V8 标准 合规 但是 当将脚本迁移到 V8 时 可能会出现以下情况 一些不兼容的情
  • 为什么声明顺序对于通用成员很重要?

    今天我注意到以下内容无法编译 open System type MyType member this Something this F 3 this F boo This expression was expected to have ty
  • 使用 Google Maps JavaScript API v3 突出显示某个区域

    我想突出显示如下图所示的区域 该区域取自谷歌地图 使用当前版本的 API v3 可以实现这一点吗 如果是 怎么办 提前致谢 您需要知道该区域的顶点并根据它们创建多边形 但多边形目前不支持虚线描边 如果您需要虚线描边 则必须根据顶点创建具有不
  • 画布内部的 tkinter 框架未扩展以填充区域

    我有一个可滚动框架类 是从我发现的一些代码中借用的 但我无法调整它以满足我的需求 它是由 pack 管理的 但我需要使用 grid 所以我简单地打包了一个框架 self region 到它里面 这样我就可以在里面网格我的小部件 但是 该框架
  • jQuery(this) 和外部接口

    大家好 我有ExternalInterface 来调用javascript 函数 但是我现在如何使用 jQuery 来定位调用该函数的 swf 例如 我使用ExternalInterface 调用 changeObject 函数 我如何让
  • Java - 创建新文件,如何使用方法指定目录?

    我知道如何写一个file执行以下操作到指定目录 public void writefile try Writer output null File file new File C results results txt output new
  • PushViewController 花费太多时间来显示视图

    我有一个非常轻的 ViewController 它在 viewDidLoad 中什么也不做 我将此视图推到导航控制器之上 执行此操作的方法是从块内部调用的 调用 showView 后 我添加了一个 NSLog 该日志在控制台中打印得非常快
  • 在单独的 .kv (Kivy) 文件中定义的屏幕之间切换

    我曾经通过在单个 kv 文件中定义所有内容 包括屏幕 来设法使多屏幕程序运行 通过使用root current 在 kv 文件中 或self root current 在 Python 文件中 我能够在屏幕之间切换 然而 一旦存在多个包含许
  • 在用户交互之前,dgrid 0.4.0 树看起来很平坦

    尝试使用 dgrid 0 4 0 显示树结构 没有使用过以前版本 0 3 x 的经验 我用两个文件夹构建了这个示例 alice 和 bob 每个都会有一些文件 叶子 商店 astore js define dojo base declare
  • 如何在 bazel 中为 Python 和 pip 选择运行时?

    我正在尝试在 Ubuntu 20 04 上构建一个应用程序 其中 python3 指向 Python3 8 并且我正在构建 aganist Python3 6 我在 WORKSPACE 的同一目录中有以下运行时 cat BUILD baze
  • 连接/聚合字符串的最佳方法

    我正在寻找一种将不同行的字符串聚合到一行中的方法 我希望在许多不同的地方做到这一点 所以有一个函数来促进这一点会很好 我尝试过使用解决方案COALESCE and FOR XML 但他们就是不适合我 字符串聚合会做这样的事情 id Name
  • 如何从通过 XMLHttpRequest 接收的 html 页面创建 DOM 对象?

    我正在开发一个 chromium 扩展 因此我对我请求权限的域具有 XMLHttpRequests 的跨主机权限 我使用了 XMLHttpRequest 并获得了一个 HTML 网页 txt html 我想使用 XPath document
  • Angular UI-Router 模式删除父状态

    我正在开发一个具有 ui router 模块的角度应用程序 当进入路由器的某种状态时 我会显示一个模式对话框 然后它会替换我的父视图 我想保留父视图并将模式显示为叠加 有没有办法用 ui router 做到这一点 举个例子 statePro
  • iOS (FMX) 上的“保存到文件”

    我想将电子邮件附件保存到我的应用程序的文档文件夹 适用于 iOS 和 Android 的 C FMX 应用程序 如何将我的应用程序注册为目标 下面的屏幕截图显示我手机上名为 Termius 的应用程序是保存文件的目标 我希望我的应用程序成为
  • 有没有办法在chrome自定义选项卡中加载html内容

    是否可以使用 android 中的 chrome 自定义选项卡加载本地 html 内容 网上查了没找到解决办法 谁能帮忙啊 无法使用 Chrome 自定义选项卡直接加载 HTML 内容 但您可以尝试将内容保存到本地文件并提供 file UR
  • 无法在 Mac OS X 上安装 MySQL

    我遇到了这个问题中描述的确切问题 MYSQL安装问题 不幸的是 没有一个答案对我有帮助 并且它已关闭 我尝试学习 Ruby on Rails 但没有让 MySQL 工作 所以它与编程相关 我输入 rake db create并得到 The