Enabling transactions in MySQL the easy way

If you want to use transactions (trust me, you want) you have to use InnoDB tables, so add default-table-type=InnoDB to your mysql configuration file (my.cnf or my.ini). This solution is Hibernate friendly.

For example in windows you can use the following my.ini in the windows dir:

[mysqld]
# Uncomment the following if you want to log updates
log-bin
# Uncomment the following if you are NOT using BDB tables
skip-bdb
# Uncomment the following if you are using Innobase tables
innodb_data_file_path = ibdata1:20M:autoextend
default-table-type=InnoDB

If you are using a MySQL version previous to 4.0 you should check InnoDB configuration to enable InnoDB.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s