Rake DB Migrate MySQL
Can someone help me out? Setting up a local Rails 2.2.2 project but rake is failing. The mysql gem was installed:
Installed MySQL gem like so:
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...
Then tried to call rake:
$ rake --trace db:migrate
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
!!! 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! dlopen(/Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle, 9): Library not loaded: libmysqlclient.18.dylib Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql-2.9.0/lib/mysql/mysql_api.bundle
将mysql lib路径添加到.bash_profile
和.profile
修复了它:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
On Mavericks with rvm ruby1.8.7 and rails 2.3 I had to install mysql gem with
gem install mysql -- --with-mysql-dir=/usr/local/mysql
and then I needed export from Slinky's answer added to my .zshenv
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
Issue - !!! 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/mysql_api
Steps to Resolution -
1) gem install mysql -- --with-mysql-dir= Path_to_MySQL_root_folder
2) Running this command will show a link for download like this- http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-noinstall-6.0.2-win32.zip/from/pick
3) Copy lib/libmysql from this download folder to C:/Ruby/bin
链接地址: http://www.djcxy.com/p/35992.html上一篇: 错误:rake db:migrate时rake中止
下一篇: Rake DB迁移MySQL