How to use MySQL in Rails tutorial

The rails tutorial also entered the second week and I wanted to use mysql for the future instead of sqlite.

rails new application name --database = mysql

It is said that mysql can be used by using the above, but an error occurs. You will be asked to do the following, so follow it as is. gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/' I'm told there is an error in mysql when using rails s. I get the same error when I bundle install.

From the conclusion, it was solved by executing the following commands in order. sudo apt-get install libmariadb-dev sudo apt-get install libmysqlclient-dev sudo yum install mysql-devel' gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'

In order to install a new package, it seems that it is necessary to install the original "-dev" somehow dev in advance. It seems that an error occurred because there was no data to be the source of this gem install.

Recommended Posts

How to use MySQL in Rails tutorial
How to use custom helpers in rails
How to use credentials.yml.enc introduced in Rails 5.2
[Rails] How to use enum
[Rails] How to use select boxes in Ransack
How to use rails join
How to use JQuery in js.erb of Rails6
[Rails] How to use validation
[Rails] How to use authenticate_user!
[Rails] How to use "kaminari"
[Rails] How to use PostgreSQL in Vagrant environment
[Rails] How to use Scope
[Rails] How to use gem "devise"
How to use Lombok in Spring
[Rails] How to use devise (Note)
[Rails] How to use flash messages
[Rails] How to write in Japanese
How to use Ruby on Rails
How to use InjectorHolder in OpenAM
[Rails] How to use Active Storage
How to introduce jQuery in Rails 6
How to use classes in Java?
[Introduction to Rails] How to use render
How to install Swiper in Rails
How to implement search functionality in Rails
Multilingual Locale in Java How to use Locale
How to change app name in rails
[Ruby on Rails] How to use CarrierWave
How to use named volume in docker-compose.yml
How to insert a video in Rails
[Rails] How to use ActiveRecord :: Bitemporal (BiTemporalDataModel)
[Rails] How to use the map method
How to use Docker in VSCode DevContainer
[rails] How to configure routing in resources
[Ruby on Rails] How to use redirect_to
How to implement ranking functionality in Rails
[Note] How to use Rails 6 Devise + cancancan
[Ruby on Rails] How to use kaminari
How to use environment variables in RubyOnRails
[Rails] How to use video_tag to display videos
Understand in 5 minutes !! How to use Docker
[Rails] How to use helper method, confimartion
How to use ExpandableListView in Android Studio
How to use Map
How to write Rails
How to use rbenv
How to use letter_opener_web
How to use with_option
How to use fields_for
How to use map
How to use collection_select
How to use Twitter4J
How to use active_hash! !!
How to use MapStruct
How to use hidden_field_tag
How to use TreeSet
How to uninstall Rails
[How to use label]
How to use identity
How to use hashes
Use images in Rails