###Mysqlがうまくインストールされません。
現在Ruby on Railsを勉強してるものです。
データベースを作成しようとすると下記エラーが出ています。
発生している問題・エラーメッセージ
rails db:create
Could not find gem 'mysql2 (~> 0.5.2)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems
試したこと
$ bundle install
エラー内容
An
1Make sure that `gem install mysql2 -v '0.5.2' --source 'https://rubygems.org/'` succeeds before bundling.
https://rubygems.org/より mysql2 -v '0.5.2' をinstall
gem 'mysql2', '~> 0.5.2'
をgemfileへ記述
ターミナルにて実行
gem install mysql2 -v 0.5.2
Building
1ERROR: Error installing mysql2: 2 ERROR: Failed to build gem native extension. 3 4 current directory: /usr/local/rvm/gems/ruby-2.5.1/gems/mysql2-0.5.2/ext/mysql2 5/usr/local/rvm/rubies/ruby-2.5.1/bin/ruby -r ./siteconf20180812-6596-f6wjc9.rb extconf.rb 6checking for rb_absint_size()... yes 7checking for rb_absint_singlebit_p()... yes 8checking for rb_wait_for_single_fd()... yes 9----- 10Using mysql_config at /usr/bin/mysql_config 11----- 12checking for mysql.h... no 13checking for mysql/mysql.h... no 14----- 15mysql.h is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again. 16----- 17*** extconf.rb failed *** 18Could not create Makefile due to some reason, probably lack of necessary 19libraries and/or headers. Check the mkmf.log file for more details. You may 20need configuration options. 21 22Provided configuration options: 23 --with-opt-dir 24 --without-opt-dir 25 --with-opt-include 26 --without-opt-include=${opt-dir}/include 27 --with-opt-lib 28 --without-opt-lib=${opt-dir}/lib 29 --with-make-prog 30 --without-make-prog 31 --srcdir=. 32 --curdir 33 --ruby=/usr/local/rvm/rubies/ruby-2.5.1/bin/$(RUBY_BASE_NAME) 34 --with-mysql-dir 35 --without-mysql-dir 36 --with-mysql-include 37 --without-mysql-include=${mysql-dir}/include 38 --with-mysql-lib 39 --without-mysql-lib=${mysql-dir}/lib 40 --with-mysql-config 41 --without-mysql-config 42 43To see why this extension failed to compile, please check the mkmf.log which can be found here: 44 45 /usr/local/rvm/gems/ruby-2.5.1/extensions/x86_64-linux/2.5.0/mysql2-0.5.2/mkmf.log 46 47extconf failed, exit code 1 48 49Gem files will remain installed in /usr/local/rvm/gems/ruby-2.5.1/gems/mysql2-0.5.2 for inspection. 50Results logged to /usr/local/rvm/gems/ruby-2.5.1/extensions/x86_64-linux/2.5.0/mysql2-0.5.2/gem_make.out
yum install mysql-devel
を実行
Loaded
1You need to be root to perform this command.
とでます。
今ままでの実行内容が良かったのかわからず
ここからどのようにしたらよいかわからなくなり躓いています。
ご教示いただきたくお願いいたします。
補足情報(FW/ツールのバージョンなど)
windows 10 pro
IDE: cloud 9
ruby: 2.5.1p57
rails: 5.2.0
gem: 2.7.7
回答2件
あなたの回答
tips
プレビュー