Two errors executing rake db:migrate

Source: Internet
Author: User
Tags sqlite database

Rails does come handy, a rails generate scaffold command to generate all the files for view, controller, and model, and then execute rake db:migrate You can generate the corresponding database table structure. And this simple rake db:migrate has an unexpected problem:

Let's start with the background: rails When you create a project, the SQLite database is used by default. In order to get started quickly, I replaced the MySQL, also modified the corresponding configuration file CONFIG/DATABASE.YML.

First question:

Rake aborted!

Uninitialized constant RAKE:DSL

reason : The default installed rake version is too low and incompatible

solution : Upgrade Rake

Step : 1. Install the 0.9.2 version of Rake,gem install rake-version=0.9.2

2. Uninstall the original version (you can view the currently installed version via Gem-list rake), gem uninstall rake-version=0.8.7

3. Update all components, bundle update

4. Run Rake db:migrate. Then came the second question.


second question :

Rake aborted.

Mysql::error:query:not Connected:show TABLES

reason : MySQL5.1 LibmySQL.dll is incompatible with current rails

workaround : Replace with old version.

Step : 1. Download the old version of Libmysql.dll:http://instantrails.rubyforge.org/svn/trunk/instantrails-win/instantrails/mysql/bin/libmysql.dll

2. Put the downloaded file in the%ruby_home/bin directory.

Reference:

Http://stackoverflow.com/questions/6085610/rails-rake-problems-uninitialized-constant-rakedsl

http://rordiary.com/blog/tag/mysql/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.