DavidH
DavidH

Reputation: 11

Sequel::AdapterNotFound: LoadError: cannot load such file -- mysql

When I am trying to migrate files using command prompt: sequel -m db/migrations/ mysql://root:root@localhost/todo I get the following error:

Error: Sequel::AdapterNotFound: LoadError: cannot load such file -- mysql C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'

Below is my migration file in db/migrations:

    Sequel.migration do
     change do
        create_table :users do
        primary_key :id
        String :name, :unique => true, :length => 32, :null => false
        String :password, :length => 32, :null => false
        DateTime :created_at
     end
   end
end 

My gemfile:

>     GEM   remote: https://rubygems.org/   specs:
>     rack (2.0.3)
>     rack-protection (2.0.0)
>       rack
>     sinatra (2.0.0)
>       rack (~> 1.4)
>       rack-protection (~> 1.4)
>       tilt (~> 1.3, >= 1.3.4)
>     tilt (2.0.7)
> 
> PLATFORMS   x64-mingw32
> 
> DEPENDENCIES   bundler (= 1.15.1)   sinatra (= 2.0.0)
> 
> BUNDLED WITH
>    1.15.1

Upvotes: 1

Views: 2222

Answers (1)

three
three

Reputation: 8488

You have to use the mysql2 adapter for your connection string. That also means you have to install the mysql2 gem on your machine. Make sure you have the MySQL development package on your machine and build essentials since this gem is a native extension and has dependencies outside Ruby.

Then connect via:

sequel -m db/migrations/ mysql2://root:root@localhost/todo

Upvotes: 1

Related Questions