【问题标题】:Load Data from heroku to lokal MySQL on Windows7在 Windows 7 上将数据从 heroku 加载到本地 MySQL
【发布时间】:2013-09-07 15:29:40
【问题描述】:

我正在尝试使用 Push and Pull Databases To and From Heroku 中所述的标准语法将数据从 heroku 下载到本地 Win7 MySQL

我已经在本地使用 sqlite 进行了几次,但使用 MySQL Heroku Toolbelt 似乎无法连接到数据库。

我收到以下错误:

连接数据库失败:

Sequel::AdapterNotFound -> LoadError: cannot load such file -- mysql

您可以在下面看到我的控制台日志。我还列出了所有依赖项。 (可能我错过了一个?)

我错过了什么?


Win7 控制台:

c:\Sites\app>heroku db:pull mysql://root:passwd@localhost/app-staging
Loaded Taps v0.3.24
Warning: Data in the database 'mysql://root:passwd@localhost/app-staging' will be overwritten and will not be
recoverable.

 !    WARNING: Destructive Action
 !    This command will affect the app: app-staging
 !    To proceed, type "app-staging" or re-run this command with --confirm app-staging

> app-staging
Failed to connect to database:
  Sequel::AdapterNotFound -> LoadError: cannot load such file -- mysql

c:\Sites\app>bundle show mysql2
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32

c:\Sites\app>mysql -V
mysql  Ver 14.14 Distrib 5.6.11, for Win32 (x86)

c:\Sites\app>heroku --version
heroku/toolbelt/2.40.1 (i386-mingw32) ruby/1.9.3

【问题讨论】:

    标签: mysql ruby-on-rails heroku


    【解决方案1】:

    摆脱这种情况的最佳解决方案是在本地也使用 postgres 数据库,并使用 heroku pg:pull,目前在 pg-extras 插件 (https://github.com/heroku/heroku-pg-extras) 上可用。

    【讨论】:

      【解决方案2】:

      我赞同hgmnz的建议在本地使用PostgreSQL,但是如果你真的想通过mysql2驱动使用MySQL,你需要使用mysql2://root:passwd@localhost/app-staging而不是mysql://root:passwd@localhost/app-staging

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-05-11
        • 1970-01-01
        • 1970-01-01
        • 2015-07-20
        • 2012-04-13
        • 1970-01-01
        相关资源
        最近更新 更多