mysql找回消失的innodb引擎

  • baagee 发布于 2017-05-08 09:44:25
  • 分类:MySQL
  • 1498 人围观
  • 1 人喜欢
为了使用事务操作,数据库引擎要用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         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance    | NO           | NO   | NO         |
+------------+---------+-----------------------------------------------------------+--------------+------+------------+
4 rows in set (0.00 sec)

#首先查看mysql 的plugin_dir目录在哪里:
mysql> show variables like 'plugin_dir'; 
+---------------+--------------------------------------------+
| Variable_name | Value                                      |
+---------------+--------------------------------------------+
| plugin_dir    | /www/wdlinux/mysql-5.1.63/lib/mysql/plugin |
+---------------+--------------------------------------------+
1 row in set (0.00 sec)

#接着到这个目录下看看有没有这两个文件:
#a_innodb_plugin.so   ha_innodb.so
#以上两个文件必须要有。有的话继续,没有就要另行下载安装了,这里不多说

#接着看看是否支持动态加载, #重要的是have_dynamic_loading这行,如果是YES,那么继续
mysql> show variables like "have_%"; 
+-------------------------+----------+
| Variable_name           | Value    |
+-------------------------+----------+
| have_community_features | YES      |
| have_compress           | YES      |
| have_crypt              | YES      |
| have_csv                | YES      |
| have_dynamic_loading    | YES      |
| have_geometry           | YES      |
| have_innodb             | YES      |
| have_ndbcluster         | NO       |
| have_openssl            | DISABLED |
| have_partitioning       | NO       |
| have_query_cache        | YES      |
| have_rtree_keys         | YES      |
| have_ssl                | DISABLED |
| have_symlink            | YES      |
+-------------------------+----------+
14 rows in set (0.00 sec)

#然后就执行下面这条语句安装
mysql> INSTALL PLUGIN InnoDB SONAME 'ha_innodb.so'; 
Query OK, 0 rows affected (1.05 sec)
#最后看看数据库储蓄引擎,已经有了innodb了
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine     | Support | Comment                                                    | Transactions | XA   | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV        | YES     | CSV storage engine                                         | 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         |
| MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance     | NO           | NO   | NO         |
| MRG_MYISAM | YES     | Collection of identical MyISAM tables                      | NO           | NO   | NO         |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
5 rows in set (0.00 sec)


标签: MySQL innodb

评论

点击图片切换
还没有评论,快来抢沙发吧!