RuntimeError con mysql2 y rails3 (bundler)


Recibo este error

`establish_connection': Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter) (RuntimeError)
  from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/activerecord-

Aquí es volcado de error completo y mi config y gemfile.

Author: djot, 2010-08-12

11 answers

Tuve el mismo error después de actualizar de Ubuntu 11.10 a 12.04. Así es como solucioné el problema:

gem uninstall mysql2
bundle

Creo que la clave aquí son las 'extensiones nativas' suppose Supongo que la última vez que instalé, estaba usando una versión diferente de mysql.

Installing mysql2 (0.3.11) with native extensions
 0
Author: Josh W Lewis,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-19 17:58:48

Estaba recibiendo el mismo error al usar rails 3.0.7 y mysql2 0.3.2. La solución, que encontré aquí , es utilizar una versión anterior de mysql2. Por lo tanto, edite su gemfile a

gem 'mysql2', '< 0.3'

Y ejecutar

bundle install 
 101
Author: stream7,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-05-19 22:37:20

También necesita cambiar el adaptador de mysql a mysql2 en la base de datos.yml como se dice aquí Instalar mysql2 gem en Snow Leopard para Rails 3 con rvm

De:

development: adapter: mysql

A:

development: adapter: mysql2

 36
Author: vrybas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:53:35

¿Incluyó la gema mysql2 en su gemfile en lugar de la antigua gema mysql, y ejecutó bundle install después?

 14
Author: amaseuk,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-08-12 11:23:21

Si estás usando rvm, y posiblemente agregaste mysql2 fuera de rvm, prueba estos pasos: Confirma que tu Gemfile dice:

gem 'mysql2'

O para Rails2.x:

gem 'mysql2', '~> 0.2.11'

Entonces:

$ cd RAILS_ROOT
$ gem uninstall mysql2

Select gem to uninstall:
 1. mysql2-0.2.11
 2. mysql2-0.3.6
 3. All versions
> 3 # select "All versions"
$ rvm gemset install mysql2
$ bundle install

Ahora los rails deberían arrancar correctamente.

 6
Author: mmell,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-10-29 20:05:46

Esto también solucionó el problema que tenía con:

Please install the mysql2 adapter: `gem install activerecord-mysql2-adapter` (no such file to load -- active_record/connection_adapters/mysql2_adapter)

Realmente necesita ejecutar: gem install mysql2 y agregar la gema a su configuración.

 3
Author: maxkaplan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2010-10-26 20:00:54

Simplemente ejecute " gem install mysql" también agregue lo mismo en gemfile y ejecute bundle. trabajados

 2
Author: supriya,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-01-15 11:16:15

Si alguien todavía tiene problemas para instalar mysql2 gem con rails 3 en Windows, consulte los pasos detallados de instalación en -

Http://rorguide.blogspot.com/2011/03/installing-mysql2-gem-on-ruby-192-and.html

 2
Author: Ritesh Kumar,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-05-03 02:55:12

Soy principiante en ruby, rails y linux. Así que si esta solución no funcionó, no tengo ninguna responsabilidad:)

Paso 1:

sudo gem uninstall mysql2

Paso 2:

sudo gem install mysql -v 0.2.7

Inicie webrick, si sigue apareciendo el mismo problema reinstale rails.

Esta solución funciona para mí.

 1
Author: Tim,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-06 08:40:17

El mismo problema para mí también. Actualizado a Rails 3.1.rc4 luego bajó a 3.0.3. Funcionó para mí.

 1
Author: connie,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2011-06-30 00:00:19

A partir de 0.3.0, y ActiveRecord 3.1 - el adaptador ActiveRecord ha sido sacó de esta gema y en ActiveRecord sí mismo. Si usted necesita usar mysql2 con versiones de Rails 0.2.7 " en su Gemfile

El archivo que falta (no such file to load) se puede encontrar en las versiones anteriores a 0.3.0 de mysql2.

Citado de la documentación de mysql2

 0
Author: Rafael Perea,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-01 01:55:41