MYSQL安装故障
在我的mac上通过终端升级了几个gem之后,我创建了一个由mysql数据库备份的新rails项目。 启动应用程序后,将显示常规欢迎页面。
这是问题 – 我尝试点击标题为“关于你的应用程序的环境”的链接,我在浏览器中收到以下输出:
MissingSourceFile in Rails/infoController#properties no such file to load -- mysql
我也在终端接收此输出
The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. Processing Rails::InfoController#properties (for 127.0.0.1 at 2008-12-09 20:41:41) [GET] Processing Rails::InfoController#properties (for 127.0.0.1 at 2008-12-09 20:41:41) [GET] MissingSourceFile (no such file to load -- mysql): ...
正如它所说的那样,我试图在停止应用程序后发出“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/mymac/.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 install mysql 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 *** 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=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/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 Gem files will remain installed in /Users/mymac/.gem/ruby/1.8/gems/mysql-2.7 for inspection. Results logged to /Users/mymac/.gem/ruby/1.8/gems/mysql-2.7/gem_make.out
显然我的mysql安装有问题,因为我也尝试运行rake命令来创建数据库,这提示我以下内容。
!!! 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)
但是,当我在命令行运行“mysql –version”时,安装了mysql!
mysql Ver 14.12 Distrib 5.0.67, for apple-darwin9.4.0 (i686) using readline 5.1
我也试过发布“sudo gem install mysql”,但这也无济于事:
sudo gem install mysql Password: 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 install mysql 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 Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.7 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem_make.out
我也尝试按照bradheintz的指示发出“sudo gem install mysql – –with-mysql-config = / usr / local / mysql / bin / mysql_config”,这似乎安装好了,但是在尝试查看应用程序环境之后再次,没有ajaxy下拉发生,rails应用程序完全停止! 在应用程序决定死在我之前打印以下输出大声笑。
dyld: lazy symbol binding failed: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle Expected in: dynamic lookup dyld: Symbol not found: _mysql_init Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle Expected in: dynamic lookup Trace/BPT trap
如果有人能够理解这里发生了什么,以及如何解决这个问题,我将非常感激:)
问题是MySQL gem构建本机扩展并需要有关在何处查找某些库的系统特定信息。 您必须在命令行上提供此function。
看看这个页面 – 重要的一点(对我来说,无论如何)是:
sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
当然,请务必使用正确的路径替换您自己的系统。
另外,坚持通过sudo
运行gem install
命令。
更大的问题是,gem软件没有提供任何关于这样一个事实的反馈:你不能像对待所有其他gem那样做gem install mysql
(事实上,曾经能够用MySQLgem做)。
尝试仅强制构建32位版本(假设您使用的是Intel Mac,带有gem的-V
应该会为您提供更详细的输出)
sudo env ARCHFLAGS="-arch i386" gem install -V mysql -- --with-mysql-config=/usr/local/sql32/bin/mysql_config
此博客文章中的更多信息: http : //blog.pastie.org/2008/10/mysql-64-bit-ruby-32-bit-friends-again.html
上次我看到这个错误是当我尝试安装mysql / ruby适配器时。 我在Mac上升级rails到rails 1.2.2后遇到同样的错误,因为默认情况下1.2.2删除mysql gem。
我上次发现的原因是缺少mysql客户端或库。 以Redhat为例,您可以转到此链接,并安装mysql客户端和库。 http://dev.mysql.com/downloads/mysql/5.0.html#linux-rhel5-x86-32bit-rpms
让我知道结果。
乔
- OSX Yosemite和Xcode 6安装后的Ruby gem安装错误
- Mac High Sierra上的vim ruby不匹配
- 如何在OSX 10.11上安装Jekyll?
- OpenSSL :: X509 ::显示错误域名证书的证书
- Ruby strftime’%Z’方法返回’0545’而不是’NPT’
- rails – postgres错误:原因:库版本不兼容:libpq.5.dylib需要1.0.0或更高版本,
- 测试在我的Ubuntu pc上运行,但不在我的Mac OS X Lion 10.7.3,Ruby 1.9.3,Rails 3.2.1上运行
- 无法在MacOSX 10.6上安装ruby 1.9.1
- 使用RVM安装Ruby 2.1.3时出错