Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/google-sheets/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 什么';RubyonRails迁移出了什么问题?_Ruby On Rails - Fatal编程技术网

Ruby on rails 什么';RubyonRails迁移出了什么问题?

Ruby on rails 什么';RubyonRails迁移出了什么问题?,ruby-on-rails,Ruby On Rails,我正在尝试将RubyonRails应用程序从一台机器迁移到另一台机器,当我键入 Rake db:migrate它给出以下错误: Mysql::Error: Table 'schema_migrations' already exists: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB 可能的原因是什么?Hi-tryrake db:drop rake db:create rake

我正在尝试将RubyonRails应用程序从一台机器迁移到另一台机器,当我键入 Rake db:migrate它给出以下错误:

Mysql::Error: Table 'schema_migrations' already exists:
CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB

可能的原因是什么?

Hi-try
rake db:drop rake db:create rake db:migrate
正如Bohdan提到的那样


在我的例子中,仅仅删除和创建数据库并没有帮助。请尝试重新启动mysql服务器:

/etc/init.d/mysqld restart
/etc/init.d/mysql restart
service mysqld restart
(取决于您运行的操作系统),然后:

rake db:reset && rake db:test:clone

注意:如果您使用的是任何预加载的软件,如宙斯(zeus)或卫士(guard),请尝试在没有它的情况下运行。

检查您的config/database.yaml和相应的模式。原因不明显吗?它在错误消息中这样说:“表'schema\u migrations'已经存在”schema\u migrations不是我使用的表的一部分..它是rake/rails用于执行数据库迁移的内置表。请注意,这将在数据库中删除信息。
rake db:reset && rake db:test:clone