there is a course about installing mysql on ubuntu a course about installing mysql on ubuntu
Ruby provides Database Driven(dbd) for each database, we have got the bastic dbd ,in order to get
command gem install dbi
input the command in Terminal after installing
sudo apt-get install libmysqlclient-dev ruby-devyou must add “sudo” on the commond
you won’t get enough root without “sudo” before the commond
create table users( id int(10) unsigned not null auto_increment, username text default null, password text default null, primary key (id) ) engine=InnoDB default charset=utf8;
rails generate scaffold username:text password:text id:int
rails generate scaffold user name创建user表,表里面有两个属性,分别是name,password,其中password类型为text generate 生成,形成,造成;产生物理反应;产生(后代);引起 scaffold 支架,脚手架;<史>断头台
更新数据库中的表结构 rake db:migrate
编辑config目录下的routes.rb文件,添加代码
root 'user#index'