在我的 Rails 项目中使用 MariaDB 而不是 MySQL

Use MariaDB instead of MySQL in my Rails project(在我的 Rails 项目中使用 MariaDB 而不是 MySQL)

本文介绍了在我的 Rails 项目中使用 MariaDB 而不是 MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的 Rails 项目中使用 MariaDB 而不是 MySQL?

How can I use MariaDB instead of MySQL in my Rails project?

当我尝试安装 mysql2 gem 时返回错误,因为没有找到 mysqlclient.

When I try to install mysql2 gem it returns error,because mysqlclient was not found.

这里有一些 解决方案,但我在我的 openSUSE 上没有找到任何 libmariadbd-dev 包12.3.

Here some solution, but I didn't found any libmariadbd-dev package on my openSUSE 12.3.

推荐答案

openSUSE 好像没有 MariaDB 客户端开发包.您必须安装 libmysqlclient-devel 软件包.由于 MariaDB 被标记为 MySQL 的替代品,它必须支持 MySQL 客户端,尽管您可能会失去一些 MariaDB 的改进.

It doesn't look like openSUSE has a MariaDB client development package. You must install the libmysqlclient-devel package package. Since MariaDB is tagged as a drop in replacement for MySQL, it would have to support the MySQL clients, though you may lose tiny bits of MariaDB improvements.

似乎 mysql2 gem 应该与 MariaDB 客户端库一起使用.其他选项希望 mariadb-client 包就足够了,为这些库找到一个 3rd 方包或自己安装它们.

It appears that the mysql2 gem should function with the MariaDB client libraries. Other options are hoping the mariadb-client package is enough, find a 3rd party package for the libraries or installing them yourself.

更新现在有一个 openSUSE 的 MariaDB 存储库.它包括一个开发包和非常好的说明.将以下内容放在/etc/zypp/repos.d/下的文件中

Update There is now an MariaDB repository for openSUSE. It includes a development package, and very good instructions. Place the following in a file under /etc/zypp/repos.d/

# MariaDB 10.1 openSUSE repository list - created 2015-10-20 16:37 UTC
# http://mariadb.org/mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.1/opensuse13-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

现在您可以运行 zypper install MariaDB-client MariaDB-devel

您的问题与 Ubuntu 无关,但我敢肯定,很多人在谷歌上搜索 Ubuntu(或其衍生产品,如 Mint)将登陆此页面.在 Ubuntu 中,您必须使用 MariaDB Foundation 的 ppa,但它们包含所有开发库并支持 5.5、10.0 和 10.1 版本.然后就可以安装mariadb-servermariadb-clientlibmariadbclient-devlibmariadbclient-dev:i386(32 位客户端).

Your question isn't about Ubuntu, but I'm sure a lot of people Googling Ubuntu (or its derivatives like Mint) will land on this page. In Ubuntu, you have to install all the packages using the MariaDB Foundation's ppa, but they include all the development libraries and support the 5.5, 10.0 and 10.1 releases. Then you can install packages such as mariadb-server, mariadb-client, libmariadbclient-dev, and libmariadbclient-dev:i386 (32-bit client).

网站上的说明简单而详细.例如,在 Ubuntu 14.04 中仅安装 10.1 开发库

The instructions are simple and detailed on the site. For example, installing just the 10.1 dev libraries in Ubuntu 14.04

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
sudo add-apt-repository 'deb http://mirrors.syringanetworks.net/mariadb/repo/10.1/ubuntu trusty main'
sudo apt-get update
sudo apt-get install libmariadbclient-dev

这篇关于在我的 Rails 项目中使用 MariaDB 而不是 MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:在我的 Rails 项目中使用 MariaDB 而不是 MySQL

基础教程推荐