0
0

mysql2を調べた。

Last updated at Posted at 2024-02-27

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.

出典

https://github.com/brianmario/mysql2#:~:text=The%20Mysql2%20gem%20is%20meant%20to%20serve%20the%20extremely%20common%20use%2Dcase%20of%20connecting%2C%20querying%20and%20iterating%20on%20results.%20Some%20database%20libraries%20out%20there%20serve%20as%20direct%201%3A1%20mappings%20of%20the%20already%20complex%20C%20APIs%20available.%20This%20one%20is%20not.

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のどれかをインストールする必要があったからなのか。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0