如何在 Ruby on Rails 中连接到 MySQL? [英] How can I connect to MySQL in Ruby on Rails?

查看:40
本文介绍了如何在 Ruby on Rails 中连接到 MySQL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 Ruby on Rails 的新手.我已经阅读了本教程,听起来很简单.

I am really new in Ruby on Rails. I have read this tutorial and it sounds really easy.

但是我如何连接到我的数据库 (MySQL) 或者 Rails 使用什么?在 php 中我会使用...

But how can I connect to my database (MySQL) or what does Rails use? In php I'd use...

mysql_connect("...","...","...");
mysql_select_db("...");

我在谷歌上搜索过,没有找到任何有用的提示.

I have searched google and cannot find any useful tips.

推荐答案

您不必手动执行这些操作,请查看:http://guides.rubyonrails.org/configuring.html#configuring-a-database

You don't have to do those things manually, check this: http://guides.rubyonrails.org/configuring.html#configuring-a-database

这篇关于如何在 Ruby on Rails 中连接到 MySQL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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