mardi 3 octobre 2017

ActiveRecord::StatementInvalid: Mysql2::Error: Unknown collation: 'utf8_0900_ai_ci'

i am a newbie trying to learn ruby on rails by following the Lynda video series using ROR version 5.0 and mysql 8.02. after creating my table entries in DB>migrate>model.rb file and running "rails db:migrate" i get an error in the terminal which does not make a lot of sense to. iv using a different user and grating it mysql privileges and searching on the web but no luck.

=============================

class CreateUsers < ActiveRecord::Migration[5.0]

def up create_table :users do |t|

    t.column "first_name", :string, :limit => 25
    t.string "last_name", :limit => 50
    t.string "email", :default => '', :null => false
    t.string "password", :limit => 40

  t.timestamps
end

end

def down

drop_table :users

end

end

MBP:simple_cms $ rails db:migrate rails aborted! ActiveRecord::StatementInvalid: Mysql2::Error: Unknown collation: 'utf8_0900_ai_ci': CREATE TABLE schema_migrations (version varchar(255) COLLATE utf8_0900_ai_ci PRIMARY KEY) ENGINE=InnoDB /Users/.rvm/gems/ruby-2.3.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:120:in _query' /Users/.rvm/gems/ruby-2.3.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:120:inblock in query' /Users/.rvm/gems/ruby-2.3.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:119:in handle_interrupt' /Users/.rvm/gems/ruby-2.3.0/gems/mysql2-0.4.9/lib/mysql2/client.rb:119:inquery' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in block in execute' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_adapter.rb:590:inblock in log' /Users/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.6/lib/active_support/notifications/instrumenter.rb:21:in instrument' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_adapter.rb:583:inlog' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:218:in execute' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/mysql/database_statements.rb:31:inexecute' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:278:in create_table' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:423:increate_table' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/schema_migration.rb:27:in create_table' /Users/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract/schema_statements.rb:1008:ininitialize_schema_migrations_table'

Aucun commentaire:

Enregistrer un commentaire