[RUBY] For those who want to use MySQL for the database in the environment construction of Rails6 ~.

In the first place, MySQL and mysql2 are different

As you all know, MySQL is a database, mysql2 is a ** Rails-specific gem **, and I interpret it as a bridge that connects the database and Rails.

About mysql2 error

$ bundle install --path vendor/bundle

An error occurred while installing mysql2 (0.5.3), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.5.3' --source 'https://rubygems.org/'` succeeds before bundling.

$ gem install mysql2 -v '0.5.3'

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

And even if you do bundle install, you have become an infinite loop resident, saying, "Oh, don't get close to me !!"

I was also a resident there, but don't worry, you can escape lol


** In conclusion, it's okay if you never installed mysql2. ** **

Here, the familiar Gemfile and Gemfile.lock come out.

Gemfile is a "** to buy list " when you go to buy game software. Gemfile.lock is a " receipt **".

When doing bundle install, I look at the software on this shopping list and install the gem. The cause of the error now is the state of "** Are you going to buy the game software on the receipt again? **".

Unless you are playing game software, watching it, or saving it, lol That's it.

So, let's assume that we have never bought it and buy the new series version again. It is a story. However, there are two things to do.

$ gem uninstall mysql2


Removed the one named mysql2

And let's buy it again!

$ bundle install --path vendor/bundle

Recommended Posts

For those who want to use MySQL for the database in the environment construction of Rails6 ~.
Rails The concept of view componentization of Rails that I want to convey to those who want to quit
How to install Docker in the local environment of an existing Rails application [Rails 6 / MySQL 8]
[Rails] How to reset the database in production environment (Capistrano version)
How to use MySQL in Rails tutorial
[Rails] Reset the database in the production environment
[Environment construction] Rails + MySQL + Docker (Beginners can also use it in 30 minutes!)
How to solve the local environment construction of Ruby on Rails (MAC)!
[For internal use] For those assigned to the Spring Boot project (under construction)
I want you to use Enum # name () for the Key of SharedPreference
How to use JQuery in js.erb of Rails6
[Rails] How to use PostgreSQL in Vagrant environment
[Rails & Docker & MySQL environment construction] Could not find gem ‘mysql2 (> = 0.4.4, <0.6.0)’ in any of the gem sources listed in your Gemfile.
[Rails + Webpacker] I want to use images of assets! Until you can view the image in Vue.js
Procedure for introducing Docker into the development environment of existing Rails applications [Rails, MySQL, Docker]
Introduce Docker to the development environment and test environment of existing Rails and MySQL applications
[Rails5.2] Support for emoji of Mysql 5.7 in Docker (change character code to utf8mb4)
In the topic of "total concentration", "How to use Docker" is summarized for the virtual Mameko who sleeps in me.
I want to use a little icon in Rails
Environment construction of Rails5 + MySQL8.0 + top-level volumes with docker-compose
[For those who create portfolios] How to use font-awesome-rails
SSL in the local environment of Docker / Rails / puma
[Ruby on Rails] From MySQL construction to database change
Beginners use ubuntu in windows to prepare rails environment
[Rails] How to delete production environment MySQL data after putting it in the development environment
How to use git with the power of jgit in an environment without git commands
[Rails] I want to display the link destination of link_to in a separate tab
How to deal with the error yaml.scanner.ScannerError: while scanning for the next token that appeared in Rails environment construction with Docker
[Rails / MySQL] Mac environment construction
VS Code FAQ for those who want to escape Eclipse
[Procedure 1 for beginners] Ruby on Rails: Construction of development environment
[For those who create portfolios] How to use chart kick
When you want to change the MySQL password of docker-compose
[Rails] Where to be careful in the description of validation
[Rails] How to display information stored in the database in view
I want to recreate the contents of assets from scratch in the environment built with capistrano
[For those who want to be an inexperienced engineer in humanities] Would you like to face the escaped mathematics through Project_Euler?
Use MailHog for checking emails in the development environment (using Docker)
Introducing gem (Kaminari) recommended for those who want to organize images lined up in a row
The story of Collectors.groupingBy that I want to keep for posterity
[Rails / Heroku / MySQL] How to reset the DB of Rails application on Heroku
[Rails] How to change the page title of the browser for each page
In order not to confuse the understanding of getters and setters, [Do not use accessors for anything! ]
I want to display the images under assets/images in the production environment
[Environment construction with Docker] Rails 6 & MySQL 8
If you want to mock a method in RSpec, you should use the allow method for mock and the singleton method.
"Rails 6 x MySQL 8" Docker environment construction procedure for sharing with teams
I want to change the value of Attribute in Selenium of Ruby
[For those who create portfolios] How to use binding.pry with Docker
[RSpec] When you want to use the instance variable of the controller in the test [assigns is not recommended]
[Rails] I want to send data of different models in a form
I want to display the number of orders for today using datetime.
The story of switching from Amazon RDS for MySQL to Amazon Aurora Serverless
[Rails & Docker & MySQL environment construction] I started the container, but I can't find MySQL ...?
Run Redmine in the local environment of Windows10 Pro-Use Docker Desktop for Windows
[CircleCI] I was addicted to the automatic test of CircleCI (rails + mysql) [Memo]
[Rails] Use devise to get information about the currently logged in user
Environment construction of Ruby on Rails from 0 [Cloud9] (From Ruby version change to Rails installation)
[Error] Switch environment construction to use Ruby on Rails oss (open source)
I tried to make full use of the CPU core in Ruby
I want to display an error message when registering in the database