InnoDb 介绍:
InnoDb 存储引擎,支持事务,行锁,外键.InnoDb 设计用来处理大数据量时提供最好的
性能.
InnoDb 提供自己的缓存(buffer pool) 还缓存数据和索引.innodb 把数据和索引存放
到表空间(tablespace) ,表空间是几个磁盘文件或者是原是设备文件(raw disk). 它
不像MyISAM 存储引擎,每个表只是一个文件.(这样在某些系统下最大2G限制). 而Innodb
没有此限制,可以无限扩展.
Mysql4.0 的以后版本都支持innodb 存储.
如果你的MySQL不支持InnoDB存储引擎,请按照如下的步骤进行修改。
1.关闭MySQL数据库
2.修改my.ini文件,把skip-innodb这行注释掉
3.打开MySQL数据库
即可。
用源码 包安装mysql 5.1.34 发现show engines;里没有innodb
cp /data/mysql/share/mysql/my-innodb-heavy-4G.cnf 到/etc/my.cnf
删除mysql数据目录里的删除ibdata1、ib_logfile1、 ib_logfile0 等文件,然后,重启mysql
每一次会出错,在重启一次就OK了
.
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
让mysql默认存储引擎为Innodb
修改/etc/my.cnf
[mysqld]
default-storage-enginie=innodb然后重启mysql数据库
./mysqladmin shutdown
./mysqld_safe &mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
进入mysql 用show engines;如上图所示,Innodb已经支持了
我在 mysql 中输入 show variables like 'have_%';
看到 have_innodb 是 disable 的。配置文件在 /etc/my.cnf 请问如何设置才能使用 innodb 让 mysql 支持事务?
你编译的时候没加--disable-innodb吧?要没有的话你把my.cnf里的关于innodb的选项打开就可以了吧。
注意:建库时也要指定innodb
来源:http://cqfish.blog.51cto.com/622299/159156
http://tech.ddvip.com/2009-06/1244807603123509.html
InnoDb 存储引擎,支持事务,行锁,外键.InnoDb 设计用来处理大数据量时提供最好的
性能.
InnoDb 提供自己的缓存(buffer pool) 还缓存数据和索引.innodb 把数据和索引存放
到表空间(tablespace) ,表空间是几个磁盘文件或者是原是设备文件(raw disk). 它
不像MyISAM 存储引擎,每个表只是一个文件.(这样在某些系统下最大2G限制). 而Innodb
没有此限制,可以无限扩展.
Mysql4.0 的以后版本都支持innodb 存储.
如果你的MySQL不支持InnoDB存储引擎,请按照如下的步骤进行修改。
1.关闭MySQL数据库
2.修改my.ini文件,把skip-innodb这行注释掉
3.打开MySQL数据库
即可。
用源码 包安装mysql 5.1.34 发现show engines;里没有innodb
cp /data/mysql/share/mysql/my-innodb-heavy-4G.cnf 到/etc/my.cnf
删除mysql数据目录里的删除ibdata1、ib_logfile1、 ib_logfile0 等文件,然后,重启mysql
每一次会出错,在重启一次就OK了
.
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)
让mysql默认存储引擎为Innodb
修改/etc/my.cnf
[mysqld]
default-storage-enginie=innodb然后重启mysql数据库
./mysqladmin shutdown
./mysqld_safe &mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| CSV | YES | CSV storage engine | NO | NO | NO |
| MyISAM | YES | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | DEFAULT | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
进入mysql 用show engines;如上图所示,Innodb已经支持了
我在 mysql 中输入 show variables like 'have_%';
mysql> show variables like 'have_%';
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| have_archive | NO |
| have_blackhole_engine | NO |
| have_compress | YES |
| have_crypt | YES |
| have_csv | YES |
| have_dynamic_loading | NO |
| have_example_engine | NO |
| have_federated_engine | NO |
| have_geometry | YES |
| have_innodb | YES |
| have_merge | YES |
| have_ndbcluster | NO |
| have_openssl | NO |
| have_partitioning | NO |
| have_query_cache | YES |
| have_row_based_replication | YES |
| have_rtree_keys | YES |
| have_symlink | YES |
+----------------------------+-------+
18 rows in set (0.00 sec)
+----------------------------+-------+
| Variable_name | Value |
+----------------------------+-------+
| have_archive | NO |
| have_blackhole_engine | NO |
| have_compress | YES |
| have_crypt | YES |
| have_csv | YES |
| have_dynamic_loading | NO |
| have_example_engine | NO |
| have_federated_engine | NO |
| have_geometry | YES |
| have_innodb | YES |
| have_merge | YES |
| have_ndbcluster | NO |
| have_openssl | NO |
| have_partitioning | NO |
| have_query_cache | YES |
| have_row_based_replication | YES |
| have_rtree_keys | YES |
| have_symlink | YES |
+----------------------------+-------+
18 rows in set (0.00 sec)
看到 have_innodb 是 disable 的。配置文件在 /etc/my.cnf 请问如何设置才能使用 innodb 让 mysql 支持事务?
你编译的时候没加--disable-innodb吧?要没有的话你把my.cnf里的关于innodb的选项打开就可以了吧。
注意:建库时也要指定innodb
来源:http://cqfish.blog.51cto.com/622299/159156
http://tech.ddvip.com/2009-06/1244807603123509.html
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/3597/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2010-10-6 23:05
评论列表