Linux啟用MySQL的InnoDB引擎

來源:互聯網
上載者:User

標籤:

前幾天公司的一個項目組的同事反應說公司內部的一台Linux伺服器上的MySQL沒有InnoDB這個引擎,我當時想應該不可能啊,MySQL預設應該 就已經安裝了這個引擎的吧,於是上伺服器去看了看,發現還真沒有,於是putty到伺服器上,show engines看了一下:

    +------------+---------+      | Engine     | Support |       +------------+---------+      | CSV        | YES     |       | MRG_MYISAM | YES     |      | MEMORY     | YES     |      | MyISAM     | DEFAULT |      +------------+---------+  

列表中沒有InnoDb,第一反應是不是安裝MySQL的時候沒有編譯InnoDb呢?但心想MySQL應該是內建了的,但google發現有網友說因為InnoDb是以外掛程式的方式載入到MySQL中的,所以可以直接使用install plugin innodb soname ‘ha_innodb.so‘來啟用InnoDB,但首先我們需要查看一下是否已經編譯InnoDb:

 

    mysql> show plugins;      +------------+--------+----------------+---------+---------+      | 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     |      +------------+--------+----------------+---------+---------+  

 

但是發現連外掛程式裡面都沒有,這下可以確定是沒有編譯了,於是決定對MySQL重新編譯,當然編譯前請先備份所有資料庫,以免造成資料丟失。

 

    [[email protected]192.168.1.1]# mysqldump --all-database -u root -p > /data0/www/1.sql      [[email protected]192.168.1.1]# mysql-5.1.60]#screen -S stou      [[email protected]192.168.1.1]# mysql-5.1.60]#automake --force --add-missing      [[email protected]192.168.1.1]# mysql-5.1.60]#./configure --prefix=/usr/local/mysql/ --with-plugins=innobase      wdcp下安裝:      [[email protected]192.168.1.1]# mysql-5.1.60]#./configure --prefix=/usr/local/mysql/ --with-plugins=innobase --with-charset=gbk --with-collation=gbk_chinese_ci  

 

但是最後卻出現了以下錯誤:

    mysql.cc:1049: error: expected constructor, destructor, or type conversion before ‘*‘ token      mysql.cc: In function ‘int not_in_history(const char*)‘:      mysql.cc:2427: error: ‘HIST_ENTRY‘ was not declared in this scope      mysql.cc:2427: error: ‘oldhist‘ was not declared in this scope      mysql.cc:2427: error: ‘history_get‘ was not declared in this scope      mysql.cc: In function ‘void initialize_readline(char*)‘:      mysql.cc:2463: error: invalid conversion from ‘char** (*)()‘ to ‘char** (*)(const char*, int, int)‘      mysql.cc:2464: error: invalid conversion from ‘int (*)(const char*, int)‘ to ‘char* (*)(const char*, int)‘      mysql.cc:2465: error: invalid conversion from ‘int (*)()‘ to ‘int (*)(int, int)‘      mysql.cc:2465: error:   initializing argument 2 of ‘int rl_add_defun(const char*, int (*)(int, int), int)‘      mysql.cc: In function ‘char** new_mysql_completion(const char*, int, int)‘:      mysql.cc:2487: error: ‘completion_matches‘ was not declared in this scope      make[2]: *** [mysql.o] Error 1      make[2]: Leaving directory `/usr/download/mysql-5.1.60/client‘      make[1]: *** [all] Error 2      make[1]: Leaving directory `/usr/download/mysql-5.1.60/client‘      make: *** [all-recursive] Error 1  

Google一下發現不少人都有這個問題,其實解決這個問題只需要在configure前執行一次:

 

    [[email protected]192.168.1.1]# make clean  

 

然後再重複./configure --prefix=/usr/local/mysql/ --with-plugins=innobase和make這個步驟就可以了,然後再:

 

    [[email protected]192.168.1.1]# make install      [[email protected]192.168.1.1]# service mysqld restart      [[email protected]192.168.1.1]# mysql -u root -p      mysql> show engines;      +------------+---------+      | Engine     | Support |      +------------+---------+      | CSV        | YES     |      | MRG_MYISAM | YES     |      | MEMORY     | YES     |      | InnoDB     | YES     |      | MyISAM     | DEFAULT |      +------------+---------+  

 

InnoDB啟用成功!

轉載:http://blog.csdn.net/benben0503/article/details/8621015

 

Linux啟用MySQL的InnoDB引擎

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.