mysql - Ruby On Rails - Lynda.com - 上传导师文件

标签 mysql ruby-on-rails

我正在尝试使用 lynda.com 学习 Ruby on Rails。

Lynda 提供了每章的练习文件。这正是您的项目标题“simple_cms”此时的样子。

** 我的问题 **

我在将记录上传到 MYSQL 数据库的项目过程中犯了一个小错误。如何删除我的文件并使用 lynda 版本?这将使我相信我的项目 future 会准确无误。

我假设 - 删除文件 - 捆绑安装 - Rails 数据库:迁移

我的问题:我收到错误 - mysql 数据库已存在。

我正在使用最新版本的 ruby​​ on Rails 和 mysql

最佳答案

您还应该能够执行此操作:

rake db:drop

假设您的 Rails 应用程序至少还有一点功能。如果不是,你就必须采取困难的方式。

然后您需要连接到 MySQL 并发出DROP DATABASE databasename,其中 databasename 是您的数据库的名称。

Remember this: MySQL does not ever ask for confirmation and will immediately do anything you request of it without hesitation. It does not care if you're on a production server or if you've made a mistake. Always double-check your statements before pressing enter. I have a lot of experience with this and I still don't type the ; to "arm" the statement until I'm confident it will work.

如果您想一直废弃和重建,让您的开发生活变得更轻松的一种方法是使用类似 Vagrant 的东西。如果你熟悉Linux之类的东西。当你把整个虚拟机搞得一团糟时,你可以炸掉整个虚拟机,然后用 vagrant up 将其恢复。如果您正在启动许多一次性的小项目,您只是想尝试一下,但又不想让您的机器永久困惑,那么值得研究一下。

关于mysql - Ruby On Rails - Lynda.com - 上传导师文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41655193/

相关文章:

php - 未找到 Lumen PDO 驱动程序

php - 提交表单时,Post 方法的作用类似于 get 方法

mysql - 排除 'mirrored' 行

ruby-on-rails - 带有自定义处理器的 CarrierWave 未注册

ruby-on-rails - 无法运行 Rails 服务器,找不到 Gem 'rails(4.2.5.1) x86-mingw32'

局域网访问mysql

php - 从 SELECT QUERY 中获取子列 (id) 以用于另一个查询

ruby-on-rails - 在 ruby​​ 中构造字符串

ruby-on-rails - Hartl 教程中的 bundle exec rspec spec/requests/static_pages_spec.rb 不起作用

ruby-on-rails - 重新打开 gem 提供的 ActiveRecord 模型