InnoDB tables provide full ACID transaction support (see Chapter 1 for the defini-
tion of ACID) and row-level locking. Though other transactional table types are
available in MySQL, InnoDB is probably the transactional table that most readers of
this book will decide to use. MySQL AB (the company that maintains MySQL) pack-
ages InnoDB tables with its standard distribution and is working closely with
Innobase (
www.innobase.com) to see that these tables work well with MySQL.
If you’re hosting your application at an ISP, you’ll want to make sure that the
host supports InnoDB tables before you write your applications for those tables.
You can check to see that these tables are available by running the following query:
show variables like ‘have%’.
mysql> show variables like ‘have%’;
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| have_bdb | NO |
| have_innodb | YES |
| have_isam | YES |
| have_raid | NO |
| have_symlink | YES |
| have_openssl | NO |
+---------------+-------+
6 rows in set (0.30 sec)
As you can see from the preceding output, the value for have_innodb is YES. If
the value on your or your ISP’s system is NO, InnoDB tables are not available.
To create InnoDB tables add type=innodb to your create statement, as follows:
create table mytable(
col1 int,
col2 text
) type=innodb;
0 comments:
Post a Comment