[英]Installing mysql gem on OSX El Capitan, RVM, for legacy rails app - MySQL dmg / brew
Supporting a legacy app written in rails 2.3 and ruby 1.8.7支持用 rails 2.3 和 ruby 1.8.7 编写的遗留应用程序
Upgraded from OS X 10.9 to 10.11 1-2 months ago without issue, have RVM installed (rvm 1.26.11 (latest)), had MySQL 5.6.10 installed via brew, legacy app had mysql gem working in its gemset. 1-2 个月前从 OS X 10.9 升级到 10.11 没有问题,安装了 RVM(rvm 1.26.11(最新)),通过 brew 安装了 MySQL 5.6.10,遗留应用程序在其 gemset 中运行了 mysql gem。
Attempting to get an anaconda2 project working mysql library files were not being found, and I uninstalled via brew an older version while troubleshooting (non 5.6.10) and afterwards all rails applications no longer were able to start (missing mysql dependencies).试图让 anaconda2 项目工作的 mysql 库文件没有找到,我在故障排除时通过 brew 卸载了旧版本(非 5.6.10),之后所有的 rails 应用程序都无法启动(缺少 mysql 依赖项)。
I could not get anything working with brew, and after cleaning up all warnings using brew doctor
I still wasn't able to get MySQL running (server) so I decided to start over.我无法使用 brew 进行任何操作,在使用
brew doctor
清除所有警告后,我仍然无法运行 MySQL(服务器),因此我决定重新开始。
Uninstalled brew using ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
使用
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
卸载 brew
Re-installed MySQL using http://downloads.mysql.com/archives/get/file/mysql-5.6.27-osx10.9-x86_64.dmg
使用
http://downloads.mysql.com/archives/get/file/mysql-5.6.27-osx10.9-x86_64.dmg
重新安装 MySQL
Was able to get data re-imported into server and mysql client connecting correctly from terminal.能够将数据重新导入服务器和从终端正确连接的 mysql 客户端。
At some point during troubleshooting I had uninstalled mysql via gem uninstall mysql
and now trying to re-install the gem I get the following error:在故障排除期间的某个时候,我通过
gem uninstall mysql
,现在尝试重新安装 gem 我收到以下错误:
kh@MBP ~/c/main/code/rails/main % gem install mysql --no-ri --no-rdoc -- --with-mysql-config='/usr/local/mysql/bin/mysql_config'
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/Users/kh/.rvm/rubies/ruby-1.8.7-head/bin/ruby extconf.rb --with-mysql-config=/usr/local/mysql/bin/mysql_config
checking for mysql_ssl_set()... no
checking for rb_str_set_len()... no
checking for rb_thread_start_timer()... no
checking for mysql.h... no
checking for mysql/mysql.h... 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=/Users/kh/.rvm/rubies/ruby-1.8.7-head/bin/ruby
--with-mysql-config
Gem files will remain installed in /Users/kh/.rvm/gems/ruby-1.8.7-head@ruby-187/gems/mysql-2.9.1 for inspection.
Results logged to /Users/kh/.rvm/gems/ruby-1.8.7-head@ruby-187/gems/mysql-2.9.1/ext/mysql_api/gem_make.out
All the MySQL files appear to be in the correct places:所有 MySQL 文件似乎都位于正确的位置:
kh@MBP ~/c/main/code/rails/main % ls -l /usr/local/mysql
lrwxr-xr-x 1 kh staff 27 Mar 18 15:48 /usr/local/mysql -> mysql-5.6.27-osx10.8-x86_64
kh@MBP ~/c/main/code/rails/main % ls -l /usr/local/mysql/bin/*mysql*
-rwxr-xr-x 1 kh staff 1551 Sep 18 2015 /usr/local/mysql/bin/msql2mysql
-rwxr-xr-x 1 kh staff 4750576 Sep 18 2015 /usr/local/mysql/bin/mysql
-rwxr-xr-x 1 kh staff 4838512 Sep 18 2015 /usr/local/mysql/bin/mysql_client_test
-rwxr-xr-x 1 kh staff 16355200 Sep 18 2015 /usr/local/mysql/bin/mysql_client_test_embedded
-rwxr-xr-x 1 kh staff 6425 Sep 18 2015 /usr/local/mysql/bin/mysql_config
Any help would be appreciated.任何帮助,将不胜感激。
I was able to solve this issue by removing these RVM rubies/gems, upgrading RVM, and recompiling ruby 1.8.7 and re-installing all my gems.我能够通过删除这些 RVM rubies/gems、升级 RVM、重新编译 ruby 1.8.7 并重新安装我的所有 gem 来解决这个问题。 Seems like a migration to el capitan issue with an old version of RVM masquerading as a specific mysql issue.
似乎迁移到 el capian 问题,旧版本的 RVM 伪装成特定的 mysql 问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.