How To Install rubygem-mysql2 on AlmaLinux 8

In this tutorial we learn how to install rubygem-mysql2 in AlmaLinux 8. rubygem-mysql2 is A simple, fast Mysql library for Ruby, binding to libmysql

Introduction

In this tutorial we learn how to install rubygem-mysql2 on AlmaLinux 8.

What is rubygem-mysql2

The Mysql2 gem is meant to serve the extremely common use-case of connecting, querying and iterating on results. Some database libraries out there serve as direct 1 available. This one is not.

We can use yum or dnf to install rubygem-mysql2 on AlmaLinux 8. In this tutorial we discuss both methods but you only need to choose one of method to install rubygem-mysql2.

Install rubygem-mysql2 on AlmaLinux 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

After updating yum database, We can install rubygem-mysql2 using dnf by running the following command:

sudo dnf -y install rubygem-mysql2

Install rubygem-mysql2 on AlmaLinux 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

After updating yum database, We can install rubygem-mysql2 using yum by running the following command:

sudo yum -y install rubygem-mysql2

How To Uninstall rubygem-mysql2 on AlmaLinux 8

To uninstall only the rubygem-mysql2 package we can use the following command:

sudo dnf remove rubygem-mysql2

References

Summary

In this tutorial we learn how to install rubygem-mysql2 on AlmaLinux 8 using yum and dnf.