rails 安装mysql_06. rails gem 安装mysql

修改Gamefile

Gamefile 里添加 gem 'mysql2'

执行命令行

bundle

可以看到下图片上已经安装好依赖了

ae5f84706fc5b449af33ee537424e7fd.png

修改配置文件

修改config/database.yml文件

# SQLite. Versions 3.8.0 and up are supported.

# gem install sqlite3

#

# Ensure the SQLite 3 gem is defined in your Gemfile

# gem 'sqlite3'

#

#default: &default

# adapter: sqlite3

# pool:

# timeout: 5000

##添加msyql的配置

default: &default

adapter: mysql2

encoding: utf8mb4

pool: 5

host: 127.0.0.1

username: root

password: 123456

development:

<<:>

#database: db/development.sqlite3

database: circles_development #数据库的名称

# Warning: The database defined as "test" will be erased and

# re-generated from your development database when you run "rake".

# Do not set this db to the same as development or production.

test:

<<:>

#database: db/test.sqlite3

database: circles_test

production:

<<:>

#database: db/production.sqlite3

database: circles_production

查看rake使用命令

rake -T #查看命令

创建数据库

haima@haima-PC:/media/haima/34E401CC64DD0E28/site/go/src/ruby/circles$ rake db:create

Created database 'circles_development'

Created database 'circles_test'

下图可以看到已经创建了两个数据库

39324cf29a29fcf3fe59e9803ab55363.png

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值