mysql 安装innodb支持

系统环境:linux

数据库版本:mysql 5.1.47

 

需要要安装innodb类型支持

 查看数据库是否支持innodb

mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                    | Transactions | XA   | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV        | YES     | CSV storage engine                                         | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                      | NO           | NO   | NO         |
| MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables  | NO           | NO   | NO         |
| InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance     | NO           | NO   | NO         |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)


先查看mysql是否安装了innodb插件

Sql代码
  1. [root@localhost bin]# ./mysql  
  2. mysql> show plugin;  
  3. +------------+--------+----------------+---------+---------+  
  4. | Name       | Status | Type           | Library | License |  
  5. +------------+--------+----------------+---------+---------+  
  6. | binlog     | ACTIVE | STORAGE ENGINE | NULL    | GPL     |  
  7. | CSV        | ACTIVE | STORAGE ENGINE | NULL    | GPL     |  
  8. | MEMORY     | ACTIVE | STORAGE ENGINE | NULL    | GPL     |  
  9. | MyISAM     | ACTIVE | STORAGE ENGINE | NULL    | GPL     |  
  10. | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL    | GPL     |  
  11. +------------+--------+----------------+---------+---------+  
[root@localhost bin]# ./mysql mysql> show plugin; +------------+--------+----------------+---------+---------+ | Name       | Status | Type           | Library | License | +------------+--------+----------------+---------+---------+ | binlog     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | CSV        | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MEMORY     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MyISAM     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL    | GPL     | +------------+--------+----------------+---------+---------+ 

 

发现没有安装

Sql代码
  1. mysql> install plugin innodb soname 'ha_innodb.so';  
  2. ERROR 1126 (HY000): Can't open shared library '/usr/local/mysql/lib/mysql/plugin/ha_innodb.so' (errno: 13 cannot restore segment prot after reloc: Permission denied)  
mysql> install plugin innodb soname 'ha_innodb.so'; ERROR 1126 (HY000): Can't open shared library '/usr/local/mysql/lib/mysql/plugin/ha_innodb.so' (errno: 13 cannot restore segment prot after reloc: Permission denied) 

 

发现权限有问题

Sql代码
  1. [root@localhost plugin]# chcon -t texrel_shlib_t /usr/local/mysql/lib/mysql/plugin/ha_innodb.so  
[root@localhost plugin]# chcon -t texrel_shlib_t /usr/local/mysql/lib/mysql/plugin/ha_innodb.so 

 

给权限再安装

Java代码
  1. mysql> install plugin innodb soname 'ha_innodb.so';  
  2. Query OK, 0 rows affected (0.36 sec)  
  3. mysql> show plugin;  
  4. +------------+--------+----------------+--------------+---------+  
  5. | Name       | Status | Type           | Library      | License |  
  6. +------------+--------+----------------+--------------+---------+  
  7. | binlog     | ACTIVE | STORAGE ENGINE | NULL         | GPL     |  
  8. | CSV        | ACTIVE | STORAGE ENGINE | NULL         | GPL     |  
  9. | MEMORY     | ACTIVE | STORAGE ENGINE | NULL         | GPL     |  
  10. | MyISAM     | ACTIVE | STORAGE ENGINE | NULL         | GPL     |  
  11. | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL         | GPL     |  
  12. | InnoDB     | ACTIVE | STORAGE ENGINE | ha_innodb.so | GPL     |  
  13. +------------+--------+----------------+--------------+---------+  
  14. 6 rows in set, 1 warning (0.00 sec)  
mysql> install plugin innodb soname 'ha_innodb.so'; Query OK, 0 rows affected (0.36 sec) mysql> show plugin; +------------+--------+----------------+--------------+---------+ | Name       | Status | Type           | Library      | License | +------------+--------+----------------+--------------+---------+ | binlog     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | | CSV        | ACTIVE | STORAGE ENGINE | NULL         | GPL     | | MEMORY     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | | MyISAM     | ACTIVE | STORAGE ENGINE | NULL         | GPL     | | MRG_MYISAM | ACTIVE | STORAGE ENGINE | NULL         | GPL     | | InnoDB     | ACTIVE | STORAGE ENGINE | ha_innodb.so | GPL     | +------------+--------+----------------+--------------+---------+ 6 rows in set, 1 warning (0.00 sec) 

 

安装成功

 

修改mysql配置文件/etc/my.cnf为以下内容.只为安装.就用默认值了.

Java代码
  1. # Uncomment the following if you are using InnoDB tables  
  2. innodb_data_home_dir = /usr/local/mysql/var/  
  3. innodb_data_file_path = ibdata1:10M:autoextend  
  4. innodb_log_group_home_dir = /usr/local/mysql/var/  
  5. # You can set .._buffer_pool_size up to 50 - 80 %  
  6. # of RAM but beware of setting memory usage too high  
  7. innodb_buffer_pool_size = 16M  
  8. innodb_additional_mem_pool_size = 2M  
  9. # Set .._log_file_size to 25 % of buffer pool size  
  10. innodb_log_file_size = 5M  
  11. innodb_log_buffer_size = 8M  
  12. innodb_flush_log_at_trx_commit = 1  
  13. innodb_lock_wait_timeout = 50  
# Uncomment the following if you are using InnoDB tables innodb_data_home_dir = /usr/local/mysql/var/ innodb_data_file_path = ibdata1:10M:autoextend innodb_log_group_home_dir = /usr/local/mysql/var/ # You can set .._buffer_pool_size up to 50 - 80 % # of RAM but beware of setting memory usage too high innodb_buffer_pool_size = 16M innodb_additional_mem_pool_size = 2M # Set .._log_file_size to 25 % of buffer pool size innodb_log_file_size = 5M innodb_log_buffer_size = 8M innodb_flush_log_at_trx_commit = 1 innodb_lock_wait_timeout = 50

 

重启数据库

 

Java代码
  1. /etc/init.d/mysqld restart  
/etc/init.d/mysqld restart

 

到此完成.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值