环境: OS: OSX 10.11.2 Ruby: 2.1.1 Mysql2: 0.4.2 Rails : 4.2.0 MysqlDB: 5.5.44
mysql 是通过 brew install mysql55 装的,mysql2 通过下面的命令安装:
gem install mysql2 -v '0.4.2' -- --with-mysql-dir=/usr/local/opt/mysql55 --with-mysql-config=/usr/local/opt/mysql55/bin/mysql_config
安装日志:
Fetching: mysql2-0.4.2.gem (100%)
Building native extensions with: '--with-mysql-dir=/usr/local/opt/mysql55 --with-mysql-config=/usr/local/opt/mysql55/bin/mysql_config'
This could take a while...
Successfully installed mysql2-0.4.2
Parsing documentation for mysql2-0.4.2
Installing ri documentation for mysql2-0.4.2
Done installing documentation for mysql2 after 0 seconds
1 gem installed
在 bundle install 之后,使用 bundle exec rake db:migrate 后报错:
dyld: lazy symbol binding failed: Symbol not found: _mysql_server_init
Referenced from: /Users/swchen/.rvm/gems/ruby-2.1.1@casoc_blog/extensions/x86_64-darwin-12/2.1.0-static/mysql2-0.4.2/mysql2/mysql2.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_server_init
Referenced from: /Users/swchen/.rvm/gems/ruby-2.1.1@casoc_blog/extensions/x86_64-darwin-12/2.1.0-static/mysql2-0.4.2/mysql2/mysql2.bundle
Expected in: flat namespace
[1] 11038 trace trap bundle exec rake db:migrate
google 到了相同问题,但没有解决方法,各位大神帮忙看看,谢谢