Rake DB迁移MySQL

时间:2012-11-29 18:22:31

标签: mysql ruby-on-rails rake

有人可以帮帮我吗?设置本地Rails 2.2.2项目但是rake失败了。安装了mysql gem:

像这样安装了MySQL gem:

sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Successfully installed mysql-2.9.0
1 gem installed
Installing ri documentation for mysql-2.9.0...
Installing RDoc documentation for mysql-2.9.0...

然后试着打电话给rake:

$ rake --trace db:migrate

**调用db:migrate(first_time)
**调用环境(first_time)
**执行环境
**执行db:migrate
!捆绑的mysql.rb驱动程序已从Rails 2.2中删除。
请安装mysql gem并再试一次:gem install mysql。 耙子流产! dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle,9):未加载库:libmysqlclient.18.dylib   参考自:/Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle   原因:找不到图像 - / Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle

3 个答案:

答案 0 :(得分:5)

将mysql lib路径添加到.bash_profile.profile修复它:

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

答案 1 :(得分:1)

在小牛队用rvm ruby​​1.8.7和rails 2.3我不得不用

安装mysql gem
gem install mysql -- --with-mysql-dir=/usr/local/mysql

然后我需要将Slinky的答案添加到我的.zshenv

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

答案 2 :(得分:0)

问题 - !!!捆绑的mysql.rb驱动程序已从Rails 2.2中删除。请安装 mysql的宝石再试一次:gem install mysql。 耙子流产了! 没有这样的文件加载 - mysql / mysql_api

解决方案的步骤 -

1)gem install mysql - --with-mysql-dir = Path_to_MySQL_root_folder

2)运行此命令将显示如下链接: http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick

3)将lib / libmysql从此下载文件夹复制到C:/ Ruby / bin