[英]Can't connect my development environment to a newly imported postgres database
Someone sent me the sql files of a dump database. 有人给我发送了转储数据库的sql文件。 I imported it through the following command:
psql my_dbname < infile.sql
我通过以下命令将其导入:
psql my_dbname < infile.sql
I changed my database.yml file with the following: 我使用以下命令更改了database.yml文件:
development:
<<: *default
database: my_dbname
But when I run rails server, I don't have the expected data. 但是,当我运行Rails服务器时,我没有期望的数据。 Is there something I'm missing ?
有什么我想念的吗? I think there are some stuff I need to do with roles but I'm not sure.
我认为角色需要做一些事情,但我不确定。
Thanks :) 谢谢 :)
Are you done with rake db:create
and rake db:migrate
before importing the .sql file if not then do the following 在导入.sql文件之前,是否已经完成
rake db:create
和rake db:migrate
的操作,否则请执行以下操作
rake db:create
rake db:migrate
and then import .sql file 然后导入.sql文件
psql my_dbname < infile.sql
You can try: 你可以试试:
rake db:create
rake db:migrate
psql -d my_dbname -a -f infile.sql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.