Tag: mysql2

在Mac OS x Lion上安装mysql2 gem

前几天我更新到了Mac OSX Lion。 它打破了我的rails安装,因为我不得不重新编译mysql。 虽然我有工作重新安装mysql2gem已成为问题。 我当时正在跑豹,所以我要从32位到64位。 ~/code/rails/london (master)$ gem install mysql2 — –with-mysql-dir=/usr/local/mysql Building native extensions. This could take a while… ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /Users/stewartmatheson/.rvm/rubies/ruby-1.9.2-p0/bin/ruby extconf.rb –with-mysql-dir=/usr/local/mysql checking for rb_thread_blocking_region()… *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries […]

MySQL2 gem不会安装

我一直试图在我的Ubuntu 12.04服务器上安装Gitlab很长一段时间,直到我运行bundle install之前一切顺利。 它说它无法安装MySQL2,但没有给出任何理由或纠正措施。 home/gitlab/gitlab$ sudo -u gitlab -H bundle install –deployment –without development test postgres Fetching gem metadata from http://rubygems.org/……. Fetching gem metadata from http://rubygems.org/.. Using rake (10.0.1) Using i18n (0.6.1) Using multi_json (1.3.7) Using activesupport (3.2.9) Using builder (3.0.4) Using activemodel (3.2.9) Using erubis (2.7.0) Using journey (1.0.4) Using rack (1.4.1) Using rack-cache […]

通过CentOS 64位在Ruby 1.9.2中安装rubygem’mysql2’时出现编译器错误

带有Ruby 1.8.7和1.9.2的CentOS 64位服务器 {{没有RVM,需要它没有RVM …目前所有Ruby1.9.2二进制文件都是ruby19并且类似地可访问,因此没有gem-path或任何类型的任何映射}}} 安装gem’mysql2’时出错… 我安装了所有依赖项,并且都是64位版本 … 所有错误都属于{./client.h:13:错误:重新定义typedef’rb_unblock_function_t’} 可能{#warning ruby​​sig.h已过时}是理由吗? 控制台捕获: #gem19 install mysql2 -v 0.2.7 — –with-mysql-dir=/usr/bin –with-mysql-config=/usr/bin/mysql_config –with-mysql-include=/usr/include/mysql Building native extensions. This could take a while… ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. /usr/bin/ruby19 extconf.rb –with-mysql-dir=/usr/bin –with-mysql-config=/usr/bin/mysql_config –with-mysql-include=/usr/include/mysql checking for rb_thread_blocking_region()… no checking for mysql.h… yes checking for […]

如何使用ruby mysql2执行事务

我已经开始使用mysql2 gem了。 我试图找出一些基本的东西 – 其中之一是如何显式执行事务(对于批处理操作,如多个INSERT / UPDATE查询)。 在旧的ruby-mysql ,这是我的方法: client = Mysql.real_connect(…) inserts = [ “INSERT INTO …”, “UPDATE .. WHERE id=..”, # etc ] client.autocommit(false) inserts.each do |ins| begin client.query(ins) rescue # handle errors or abort entirely end end client.commit 我在文档中找不到多少 – 如何用mysql2完成相同的操作?

迁移创建表引发Mysql2 ::错误:表不存在

我用以下内容编写了一个迁移: class CreateTableSomeTable < ActiveRecord::Migration[5.1] def change create_table :some_tables do |t| t.references :user, foreign_key: true t.references :author, references: :user, foreign_key: true t.text :summary end end end 这是一个创建数据库表的基本迁移。 但是:当我运行rails db:migrate一条非常奇怪的错误消息会中止迁移: Mysql2 ::错误:表’my_database.some_tables’不存在:显示来自’some_tables’的完整字段 就好像错误说它无法创建表,因为表确实存在,这没有意义。 我看过并试过的事情: 审查了database.yml,这似乎很好。 什么都没有改变,我最近运行其他迁移就好了(虽然没有创建数据库表的迁移) 运行bundle以确保安装了所有gem 删除了schema.rb文件,用另一个副本中的数据重新创建了数据库,然后运行了rake db:schema:dump来重新创建schema.rb文件。 我试图再次运行迁移,但仍然遇到同样的错误。 我使用rails 5.1.1以及mysql2 0.4.6 关于如何让迁移运行的任何提示?

无法加载此类文件 – mysql2 / 2.4 / mysql2(LoadError) – windows

我是Ruby on Rails的新手。 我的Ruby版本是ruby 2.4.1p111(2017-03-22修订版58053)[x64-mingw32]。 我使用rails new sample_cms -d mysql命令创建了一个新项目。 命令rails server抛出以下错误。 C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/mysql2-0.4.6-x64-mingw32/lib/mysql2/mysql2.rb:2:in `require’: cannot load such file — mysql2/2.4/mysql2 (LoadError) 我已经安装了mysql和mysql Connector C.我已经安装了mysql2 gem。 gem install mysql2 —platform=ruby — ‘—with-mysql-dir=”C:\Program Files\MySQL\MySQL Connector C 6.1″‘ 我已经卸载并安装了mysql2 gem,但仍然面临着这个问题。 这是可能有问题的目录。 目录的图像 这是mysql2的gem文件条目 # Bundle edge Rails instead: gem ‘rails’, github: ‘rails/rails’ gem ‘rails’, ‘~> 5.1.1’ # Use […]

Ruby mysql2 gem编译为错误的mysql客户端库版本

使用apt-get将MySQL更新到5.5后, mysql2 gem停止工作。 这是错误: Incorrect MySQL client library version! This gem was compiled for 5.5.17 but the client library is 5.1.58. (RuntimeError) 我尝试使用mysql_config重新安装但它似乎没有什么区别.. gem install mysql2 — –with-mysql-config=/usr/bin/mysql_config 相应地,我试着告诉bundle使用mysql-config编译mysql2但是仍然存在错误。 bundle config build.mysql2 –with-mysql-config=/usr/bin/mysql_config bundle install 当我尝试使用较旧版本的gem(v0.2.6)时,rails控制台会打开,但在运行任何类型的查询后都会崩溃。 在尝试最新版本的mysql2 gem时,这是完整的错误堆栈: [marco@linode:/www] 07:29:00 AM: rails c /users/marco/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/mysql2-0.3.10/lib/mysql2.rb:9:in `require’: Incorrect MySQL client library version! This gem was compiled for […]

无法安装mysql2 gem

我无法在我的Windows7 x64系统中安装mysql2 gem。 我尝试使用32位和64位版本的MySQL服务器,但没有一个让我更进一步。 我安装了Ruby 1.8,开发工具包和Rails平台。 我甚至安装了minGW来允许C ++ / C编译。 MySQL Server安装在默认位置。 运行命令时: C:\Users\Arne>gem install mysql2 — –with-mysql-include=”C:\Program Files (x86)\MySQL\MySQL Server 5.1\include” –with-mysql-lib=”C:\Program Files (x86)\MySQL\MySQL Server 5.1\lib\” 我从控制台收到以下输出: Temporarily enhancing PATH to include DevKit… Building native extensions. This could take a while… *** extconf.rb failed *** Could not create Makefile due to some reason, probably […]

无法在Windows 7上安装MySQL2 gem

我在安装时收到以下错误消息,请告诉我是否需要发布更多详细信息。 我按照以下位置的说明操作: https : //github.com/oneclick/rubyinstaller/wiki/Development-Kit 我正在使用ruby 1.9.2p136(2010-12-25)[i386-mingw32]。 这是我得到的: E:\work_desk\trunk>gem install mysql2 -v 0.2.4 Temporarily enhancing PATH to include DevKit… Building native extensions. This could take a while… ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/Ruby192/bin/ruby.exe extconf.rb checking for rb_thread_blocking_region()… yes checking for main() in -llibmysql… no *** extconf.rb failed *** Could […]