How to access sqlite database

不知道会有多少人遇到同样的问题,ROR装好之后,怎样访问sqlite数据库?

命令:rails dbrails dbconsole 

或者 sqlite3 db/development.sqlite3

D:\Ruby\projects\blog>rails db
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from posts;
1|Hello World.|15mins build a blog with ROR.

PTIAN
|2013-04-06 03:39:30.770540|2013-04-06 03:39:30.770540
2|||2013-04-06 03:58:18.954069|2013-04-06 03:58:18.954069
3|2nd post|write something....|2013-04-06 03:58:58.049305|2013-04-06 03:58:58.049305
sqlite>

D:\Ruby\projects\blog>sqlite3 db/development.sqlite3
SQLite version 3.7.15.2 2013-01-09 11:53:05
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite>

如果想通过GUI连数据库的话,推荐SQLite Manager,这是一个Firefox的插件

连接数据库时,需要选择sqlite数据库文件,这个文件的位置在rails_project\db\development.sqlite3


请使用浏览器的分享功能分享到微信等