mysql2をインストールする理由
具体的にわからなかった。今後の自分に頼るしかない。
以下調べた内容。
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:1 mappings of the already complex C APIs available. This one is not.
It also forces the use of UTF-8 [or binary] for the connection and uses encoding-aware MySQL API calls where it can.
出典
Mysql2 gemは、接続、クエリ、結果の反復処理という極めて一般的なユースケースに対応するためのものです。世の中に出回っているデータベースライブラリの中には、すでに利用可能な複雑なC APIを直接1:1にマッピングしたものもある。これはそうではない。
また、接続に UTF-8 [またはバイナリ] を使用することを強制し、エンコーディングを意識した MySQL API 呼び出しを可能な限り使用します。
出典
deepL
RDBMS に接続するためには、クライアントライブラリが必要になります。
出典
mysql2をバージョンダウンさせたものをインストールできない。
多分最新のものしかインストールできないのかもしれない。
mysql-develをインストールする理由
This gem links against MySQL's libmysqlclient library or Connector/C library, and compatible alternatives such as MariaDB. You may need to install a package such as libmariadb-dev, libmysqlclient-dev, mysql-devel, or other appropriate package for your system. See below for system-specific instructions.
出典
https://github.com/brianmario/mysql2#:~:text=This%20gem%20links,system%2Dspecific%20instructions.
このgemは、MySQLのlibmysqlclientライブラリまたはConnector/Cライブラリ、およびMariaDBなどの互換性のある代替ライブラリに対してリンクします。libmariadb-dev、libmysqlclient-dev、mysql-develなど、システムに適したパッケージをインストールする必要があるかもしれません。システム固有の手順については以下を参照のこと。
出典
deepl
Linux and other Unixes
You may need to install a package such as libmariadb-dev, libmysqlclient-dev, mysql-devel, or default-libmysqlclient-dev; refer to your distribution's package guide to find the particular package. The most common issue we see is a user who has the library file libmysqlclient.so but is missing the header file mysql.h -- double check that you have the -dev packages installed.
出典
https://github.com/brianmario/mysql2#:~:text=Linux%20and%20other,dev%20packages%20installed.
libmariadb-dev、libmysqlclient-dev、mysql-devel、default-libmysqlclient-dev などのパッケージをインストールする必要があるかもしれません。ディストリビューションのパッケージ・ガイドを参照して、特定のパッケージを見つけてください。最もよく見られる問題は、ライブラリ・ファイルlibmysqlclient.soはあるが、ヘッダ・ファイルmysql.hがないというユーザーです。
出典
deepL
気づき
mysql2をインストールするときにはlibmariadb-dev, libmysqlclient-dev, mysql-devel, or default-libmysqlclient-devのどれかをインストールする必要があったからなのか。