使用 Heroku db:pull 一个新数据库
我正在尝试学习如何使用 Heroku 的系统推送和拉取数据库,我只是有一个澄清的问题。
我现有的开发数据库名为 project_dev
,但我想创建一个新数据库。我输入了以下命令:
heroku db:pull mysql://root:mydbpassword@localhost/20110302heroku
我有一个database.yml文件,其中包括我的开发、测试和生产数据库,并且我从Heroku得到了这样的响应:
Auto-detected local database: mysql://root:mydbpassword@localhost/project_dev?encoding=utf8
这是否意味着如果我想拉取,我必须首先手动创建一个新数据库来自赫罗库?这是否意味着除非在我的database.yml 文件中显式定义数据库,否则我根本无法拉取?
任何指示都会非常有帮助。我浏览了 Google、Heroku 和 SO,但没有找到我想要的答案。谢谢你!
I am trying to learn how to push and pull databases using Heroku's system, I just have a clarifying question.
My existing development database is called project_dev
but I want to create a new database. I entered in the following command:
heroku db:pull mysql://root:mydbpassword@localhost/20110302heroku
I have a database.yml file that includes my development, test, and production dbs, and I got this response from Heroku:
Auto-detected local database: mysql://root:mydbpassword@localhost/project_dev?encoding=utf8
Does this mean I have to manually create a new database first if I want to pull from Heroku? Does it mean that I cannot pull at all unless the db is explicitly defined in my database.yml file?
Any pointers would be really helpful. I had a look around on Google, Heroku and SO, but I didn't find the answers I was looking for. Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您必须首先创建新的本地数据库,但不必在 database.yml 文件中声明它。
当我运行 Heroku db:pull mysql://root:mydbpassword@localhost/newdb 时,它会正确导入到 newdb 数据库中。我不确定为什么它会自动检测您的本地开发数据库。您使用最新的heroku 和taps gem 吗?
Yes, you'll have to first create the new local database but you don't have to declare it in your database.yml file.
When I run
heroku db:pull mysql://root:mydbpassword@localhost/newdb
it correctly imports into thenewdb
database. I'm not sure why it auto-detects your local dev database. Do you use the latest heroku and taps gems?