# Beginner mysql problem involving Rake

**URL:** <https://www.ruby-forum.com/t/beginner-mysql-problem-involving-rake/136276>\
**Category:** Rails\
**Created:** [April 30, 2008, 9:58am UTC](https://www.ruby-forum.com/t/beginner-mysql-problem-involving-rake/136276 "2008-04-30T09:58:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![donald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@donald](https://www.ruby-forum.com/u/donald)\
**Post date:** [April 30, 2008, 9:58am UTC](https://www.ruby-forum.com/t/beginner-mysql-problem-involving-rake/136276/1 "2008-04-30T09:58:05Z")

</div>

Hello, I’m new to rails and I’m trying to get a tutorial application  
off the ground

when running rake migrate it errors with a mysql syntax error  
response:

Mysql::Error: You have an error in your SQL syntax; check the manual  
that corresponds to your MySQL server version for the right syntax to  
use near '(11), `name` varchar(255) DEFAULT NULL, `address`  
varchar(255) DEFAULT NULL, `ci' at line 1: CREATE TABLE people (`id`int(11) DEFAULT NULL auto_increment PRIMARY KEY(11),`name`varchar(255) DEFAULT NULL,`address`varchar(255) DEFAULT NULL,`city`varchar(255) DEFAULT NULL,`state`varchar(255) DEFAULT NULL,`zipcode` varchar(255) DEFAULT NULL) ENGINE=InnoDB

My db file is as follows:

class ContactDb \< ActiveRecord::Migration  
def self.up  
create\_table “people” do |t|  
t.column “id”, :integer  
t.column “name”, :string  
t.column “address”, :string  
t.column “city”, :string  
t.column “state”, :string  
t.column “zipcode”, :string  
end  
end

def self.down  
drop\_table :people  
end  
end

I’m using a default mysql, apache, ruby, rails etc. install.

I noticed that It set the value of PRIMAY KEY to 11 and thought that  
was kind of strange.  
Anybody got any suggestions to get rake working right?

Thanks,  
Donald

---

<div class="post-metadata">

**Author:** ![donald](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ac8455/32.png) [@donald](https://www.ruby-forum.com/u/donald)\
**Post date:** [April 30, 2008, 10:18am UTC](https://www.ruby-forum.com/t/beginner-mysql-problem-involving-rake/136276/2 "2008-04-30T10:18:10Z")

</div>

Hi,

2008/4/30 Donald [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

> Mysql::Error: You have an error in your SQL syntax; check the manual  
> that corresponds to your MySQL server version for the right syntax to  
> use near '(11), `name` varchar(255) DEFAULT NULL, `address`  
> …  
> class ContactDb \< ActiveRecord::Migration  
> def self.up  
> create\_table “people” do |t|  
> t.column “id”, :integer  
> t.column “name”, :string

You must not create the id column in the migration. This is done  
automatically. I guess that the SQL syntax error consists in two  
columns named id.

Lutz

–  
Do you want a Google Mail invitation? Just write me an email!
