Using wamp's Mysql for Ruby on Rails
I am new to ROR. I have wamp all ready to go, I'd like to use its mysql for ROR so that I can access the database from phpmyadmin. How should I do that?
Here is what I have in database.yml:开发者_运维问答
development: adapter: mysql encoding: utf8 reconnect: false database: my_database pool: 5 username: root password: host: localhost port: 3306 socket: /tmp/mysql.sock
When I run rake db:create, I get: The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted!
Thanks a lot.
Did you install Ruby with the Ruby Installer for Windows (available from http://www.rubyinstaller.org if you didn't)?
You'll need to do some extra steps to get MySQL up and running, due to a problem with the MySQL gem under Windows.
- Download the "Devkit" available from the above site and install it according to the instructions.
You'll need the libmysql.dll from your MySQL installation to proceed; if you haven't got that in your installation, download the full package of MySQL from their website (you don't need to install it, just get that file).
Once you have that, you can copy that file into your Ruby bin directory.
Then open a command prompt, and type
gem install mysql
That should get you up and running. But you will need to restart your application.
I think that's covered all the steps I needed to do. I believe the libmysql.dll needs to be from the 5.0 release of MySQL, but I wasn't able to confirm that. If this doesn't answer your question, post a comment and I'll run through the steps again to make sure I haven't missed anything (I've had the RubyInstaller working with Rails and MySQL on Windows for a while now).
精彩评论