Unable to install “mysql2” gem on Linux (CentOS)

时间:2023-02-10 10:39:26

I am unable to install the "mysql2" gem on my CentOS linux machine.

我无法在我的CentOS linux机器上安装“mysql2”gem。

I recently install mysql following the following tutorial: http://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-centos

我最近按照以下教程安装了mysql:http://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-centos

When I try to download "mysql2" gem I get the following log:

当我尝试下载“mysql2”gem时,我得到以下日志:

[root@vc2cmmka035538n ruby]# gem install mysql2
ERROR:  Could not find a valid gem 'mysql2' (>= 0) in any repository
ERROR:  Possible alternatives: mysql

Environment info:

  • Rails 3.2.3
  • ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
  • ruby 1.8.7(2011-06-30 patchlevel 352)[x86_64-linux]

  • gem -v 1.8.24
  • 宝石-v 1.8.24

1 个解决方案

#1


0  

From their github page, quoted

引用他们的github页面

This gem links against MySQL's libmysqlclient C shared library. You may need to install a package such as libmysqlclient-dev, mysql-devel, or other appropriate package for your system.

这个gem链接到MySQL的libmysqlclient C共享库。您可能需要为系统安装libmysqlclient-dev,mysql-devel或其他适当的软件包。

So, you might wanna install those packages first. Then you can even manually compile the gem if you still face the problem. https://github.com/brianmario/mysql2

所以,你可能想先安装这些包。然后,如果您仍然遇到问题,甚至可以手动编译gem。 https://github.com/brianmario/mysql2

If mysql repo is disabled on your system, here is the link about installing them

如果在您的系统上禁用了mysql repo,则以下是有关安装它们的链接

http://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html

#1


0  

From their github page, quoted

引用他们的github页面

This gem links against MySQL's libmysqlclient C shared library. You may need to install a package such as libmysqlclient-dev, mysql-devel, or other appropriate package for your system.

这个gem链接到MySQL的libmysqlclient C共享库。您可能需要为系统安装libmysqlclient-dev,mysql-devel或其他适当的软件包。

So, you might wanna install those packages first. Then you can even manually compile the gem if you still face the problem. https://github.com/brianmario/mysql2

所以,你可能想先安装这些包。然后,如果您仍然遇到问题,甚至可以手动编译gem。 https://github.com/brianmario/mysql2

If mysql repo is disabled on your system, here is the link about installing them

如果在您的系统上禁用了mysql repo,则以下是有关安装它们的链接

http://dev.mysql.com/doc/mysql-repo-excerpt/5.6/en/linux-installation-yum-repo.html