在Ruby on Rails应用程序中将数据库从PostgreSQL更改为MySQL [英] changing database from PostgreSQL to MySQL in a Ruby on Rails app

查看:347
本文介绍了在Ruby on Rails应用程序中将数据库从PostgreSQL更改为MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我目前的应用程序中,我使用PostgreSQL数据库,



但我想将PostgreSQL数据库更改为MYSQL DB。



如果不可能?

解决方案

步骤1
$ b

为您的数据备份副本



对于Rails 3,安装YAML DB gem: https://github.com/ludicast/yaml_db



对于Rails 2.x安装YAML数据库插件:



脚本/插件安装git://github.com/adamwiggins/yaml_db.git



运行转储任务



rake db:dump



步骤2 / p>

更新config / database.yml文件。



步骤3:



gem install mysql



有rake创建数据库



rake db:create



< schema:load



步骤4



使用YamlDb将数据重新加载到MySql



rake db:load


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 ?

解决方案

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

这篇关于在Ruby on Rails应用程序中将数据库从PostgreSQL更改为MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆