Rails error installing mysql2 (mysql2-0.3.20) Rails error installing mysql2 (mysql2-0.3.20) ruby-on-rails ruby-on-rails

Rails error installing mysql2 (mysql2-0.3.20)


I faced the same issue when installing mysql2-0.3.21 on Mac pro.

Below mentioned solution worked for me (run the below mentioned 3 commands in the terminal pointing to your project folder):

brew install mysqlgem install mysql2 -v '0.3.21' -- --srcdir=/usr/local/mysql/includebundle install


I just ran into this problem today. mysql got updated recently, so what worked for me was:

brew install mysql@5.6brew link mysql@5.6 --forcebundle install

Alternatively, I did not try this solution, but it seems to have worked for other people.

Installing Mysql 2 gem fails


This worked for me - macOS Catalina

brew uninstall mysqlgem uninstall mysql2brew install mysql@5.7brew link mysql@5.7 --forcegem install mysql2 -v '0.3.21'# Gemfilegem 'mysql2', '0.3.21'bundle update mysql2