日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

查看mysql当前表使用的存储引擎(转)

發布時間:2025/7/14 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 查看mysql当前表使用的存储引擎(转) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

說明:
當我們創建表 “test”表時

CREATE TABLE test ( id INT(11) default NULL auto_increment, s char(60) default NULL, PRIMARY KEY(id) ENGINE=InnoDB;

一般情況這樣沒任何問題。但是,如果MySQL服務器配置中未啟用InnoDB存儲引擎。則在創建表 test 時,MySQL還是會自動選擇默認的存儲引擎MyISAM來創建test表。因為通過SHOW CREATE TABLE 表名 來查看表使用的mysql存儲引擎是不準確的。

實例:
mysql服務器未啟用InnoDB存儲引擎;
庫名:mytest;
表名:test(mytest.test);
帳號:root;
密碼:mypassword;

列 “Engine” 下顯示的值表示表正在使用的 MySQL 存儲引擎。
1.確認 MySQL 服務器 是否啟用InnoDB存儲引擎

mysql> SHOW ENGINES; +------------+---------+----------------------------------------------------------+ | Engine | Support | Comment | +------------+---------+----------------------------------------------------------+ | InnoDB | NO | Supports transactions, row-level locking, and foreign keys| | MRG_MYISAM | YES | Collection of identical MyISAM tables | | BLACKHOLE | YES | /dev/null storage engine (anything you write to it disa | CSV | YES | CSV storage engine | | MEMORY | YES | Hash based, stored in memory, useful for temporary tables| | FEDERATED | NO | Federated MySQL storage engine | | ARCHIVE | YES | Archive storage engine | | MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance| +------------+---------+----------------------------------------------------------+ 8 rows in set (0.00 sec)

返回結果是:InnoDB對應的Support為NO,表示未啟用InnoDB存儲引擎。

2.創建表 “test”

mysql> create database mytest; Query OK, 1 row affected (0.02 sec) mysql> use mytest; Database changed mysql> CREATE TABLE test ( -> id INT(11) default NULL auto_increment, -> s char(60) default NULL, -> PRIMARY KEY (id) -> ) ENGINE=InnoDB; Query OK, 0 rows affected, 2 warnings (0.06 sec) mysql>

?
3.使用“SHOW CREATE TABLE 表名” 來查看,這種方式是不準確的

mysql> SHOW CREATE TABLE test; +-------+----------------------------------------------------------------------------+ | Table | Create Table| +-------+----------------------------------------------------------------------------+ | test | CREATE TABLE `test` ( `id` int(11) NOT NULL AUTO_INCREMENT, `s` char(60) DEFAULT NULL, PRIMARY KEY (`id`) ENGINE=InnoDB DEFAULT CHARSET=latin1 | +-------+----------------------------------------------------------------------------+ 1 row in set (0.00 sec)

可以看到test表還是InnoDB引擎!!

4.使用SHOW TABLE STATUS from 數據庫庫名 where Name=’表名’;這是正確的方式

# mysql -uroot -p'mypassword' Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 221 Server version: 5.1.41-3ubuntu12.7 (Ubuntu) Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SHOW TABLE STATUS from mytest where Name='test'; +------------+--------+---------+------------+------+----------------+-------------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | +------------+--------+---------+------------+------+----------------+-------------+ | test | MyISAM | 10 | Fixed | 0 | 0 | 0 | +------------+--------+---------+------------+------+----------------+-------------+ 1 row in set (0.02 sec) mysql>

?
5.mysqlshow -u 數據庫登錄帳號 -p ‘數據庫登錄帳號密碼’ – -status 數據庫庫名 表名,這也是正確的方式

# mysqlshow -uroot -p'mypassword' --status mytest test Database:mytest Wildcard: test +------------+--------+---------+------------+------+----------------+-------------+ | Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | +------------+--------+---------+------------+------+----------------+-------------+ | test | MyISAM | 10 | Fixed | 0 | 0 | 0 | +------------+--------+---------+------------+------+----------------+-------------+

?
最后:
可以看出,在未啟用InnoDB存儲引擎的情況下,我們發現4,5步返回的結果是正確的,列Engine為MyISAM而不是InnoDB存儲引擎。而第3步使用 “SHOW CREATE TABLE 表名” 來查看表使用的mysql存儲引擎是不準確的。

轉載請注明:酷喃|coolnull|???查看mysql當前表使用的存儲引擎

http://coolnull.com/2759.html

?

轉載于:https://www.cnblogs.com/softidea/p/5352923.html

總結

以上是生活随笔為你收集整理的查看mysql当前表使用的存储引擎(转)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。