简体   繁体   中英

Ruby on Rails: MySql Gem does not work: uninitialized constant Mysql::Error

I have the following installed: Mac Os 10.7.2 (MacPro Pro, Processor Core i7) rails 3.1.0 ruby 1.9.2 mysql 5.5.19, for osx10.6 (i386)

I can install the mysql gem without problems: sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

I can also login and create a database and a dummy table.

But when I want to set up the mysql db using rake rake db:setup RAILS_ENV="production" --trace Then I receive the following error: uninitialized constant Mysql::Error

Is it possible that the MySQL version is wrongly installed? I used the "Mac OS X ver. 10.6 (x86, 64-bit)", but when I run mysql -V then it says "i386". Isn't this the 32 bit version? The full output is: Ver 14.14 Distrib 5.5.19, for osx10.6 (i386) using readline 5.1

Did you run bundle install ? Also rather than the old mysql gem, it is recommended to use the mysql2 gem.

And then when you are inside your project's root directory, run your app using bundler:

bundle exec rails s

When you use bundle, you don't need to install gems using gem install ... , just use bundle install .

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