简体   繁体   中英

`require': cannot load such file — mysql(LoadError)

when I use mysql in ruby script occurred LoadError.the detail info is below:

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- mysql (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from data.rb:3:in `<main>'

I have installed mysql2 (0.3.17) gem. And I use this script to build my ruby environment.

If you're using the mysql2 gem, you need to

require 'mysql2'

instead of

require 'mysql'

which would work if you'd installed the mysql gem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM