问题
In my current application i am using PostgreSQL Data base,
but I want to change the PostgreSQL database into MYSQL DB.
if it's impossible ?
回答1:
Step 1
Make a backup copy of your data
For Rails 3, install the YAML DB gem: https://github.com/ludicast/yaml_db
For Rails 2.x install the YAML DB plugin:
script/plugin install git://github.com/adamwiggins/yaml_db.git
Run the dump task
rake db:dump
Step 2
Update your config/database.yml file.
Step 3 :
gem install mysql
Have rake create your database
rake db:create
rake db:schema:load
Step 4
Use YamlDb to reload your data into MySql
rake db:load
回答2:
this is a duplicate
Migrate database from Postgres to MySQL
dont forget to change the gems and your database config file to something like this:
development:
adapter: mysql2
encoding: utf8
database: my_db_name
username: root
password: my_password
host: 127.0.0.1
port: 3306
来源:https://stackoverflow.com/questions/24237034/changing-database-from-postgresql-to-mysql-in-a-ruby-on-rails-app