mysql 安裝innodb支援

來源:互聯網
上載者:User

系統內容: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

 

到此完成.

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.