Friday, June 29, 2007

Django MySQL with InnoDB Tables

If you are using MySQL and want Django to create InnoDB tables on `syncdb`, use the following in your settings file:

DATABASE_ENGINE = 'mysql'
DATABASE_OPTIONS = {"init_command": "SET storage_engine=INNODB"}


This works on trunk, and isn't documented very well.

4 comments:

daniel said...

Thanks, I was looking for this! Is this the best way to do it?

Anonymous said...

Thanks,
I'm using django 0.96.2 on debian, and this InnoDB setting works ok.

Anonymous said...

work well on django 1.0 mysql 5.0 on ubuntu
Thank :)

Unknown said...

Thanks a lot, this tip is now in official documentation.