mysql - 使用 ruby​​ on rails 在 Ubuntu 上安装 MySQL [错误]

标签 mysql ruby-on-rails linux ruby-on-rails-3 ubuntu

bundle install 在下面安装 mysql 时出现错误: 我有工作台和服务器,我可以连接到它,所以这不是问题。

Installing mysql (2.8.1) with native extensions /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Instal ler::ExtensionBuildError)

        /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb  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... yes checking for mysql_query() in -lmysqlclient... no checking for main() in -lmygcc... 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=/home/ahmet/.rvm/rubies/ruby-1.9.2-p290/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
        --with-mygcclib
        --without-mygcclib
        --with-mysqlclientlib
        --without-mysqlclientlib


Gem files will remain installed in /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1 for inspection. Results logged to /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
        from /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `block in build_extensions'
        from /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `each'
        from /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `build_extensions'
        from /home/ahmet/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `install'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/source.rb:101:in `block in install'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/source.rb:91:in `install'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/installer.rb:58:in `block (2 levels) in run'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/installer.rb:57:in `block in run'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/installer.rb:49:in `run'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/installer.rb:8:in `install'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/cli.rb:220:in `install'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/vendor/thor/task.rb:22:in `run'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/vendor/thor.rb:263:in `dispatch'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/lib/bundler/vendor/thor/base.rb:386:in `start'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.16/bin/bundle:13:in `<top (required)>'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/bin/bundle:19:in `load'
        from /home/ahmet/.rvm/gems/ruby-1.9.2-p290/bin/bundle:19:in `<main>'

最佳答案

安装mysql gem之前安装如下。

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev

关于mysql - 使用 ruby​​ on rails 在 Ubuntu 上安装 MySQL [错误],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7201967/

相关文章:

php - 从数据库中获取今天的出生日期

PHP SQL 查询总结当天所有已完成的任务

html - 在 Rails 中,如何在文本区域中允许一些 html?

linux - SCHED_FIFO 线程在 Linux 中被 SCHED_OTHER 线程抢占

setpgid() 的第一个参数可以是 session 领导者还是组领导者?

java - 这是转义 SQL 查询参数的安全方法吗?

javascript - 通过 Javascript 在 mysql 中搜索

ruby-on-rails - 为什么人们不在 Rspec 中访问数据库?

ruby-on-rails - rails : Validates_format_of for float not working

linux - 执行 git push 时如何修复 .git/directory 被拒绝的权限?