createtableDemoTable->(->ClientIdintNOTNULLAUTO_INCREMENT,->ClientNamevarchar(100),->ClientAgeint,->ClientCountryNamevarchar(100),->isMarriedboolean,->PRIMARYKEY(ClientId) EN"/> createtableDemoTable->(->ClientIdintNOTNULLAUTO_INCREMENT,->ClientNamevarchar(100),->ClientAgeint,->ClientCountryNamevarchar(100),->isMarriedboolean,->PRIMARYKEY(ClientId) EN">
Rumah >pangkalan data >tutorial mysql >Tukar jadual dari MyISAM ke INNODB dalam MySQL?
Untuk melakukan ini, gunakan arahan ALTER. Mari kita buat jadual dahulu. Enjin lalai ditetapkan kepada "MYISAM" -
mysql> create table DemoTable -> ( -> ClientId int NOT NULL AUTO_INCREMENT, -> ClientName varchar(100), -> ClientAge int, -> ClientCountryName varchar(100), -> isMarried boolean, -> PRIMARY KEY(ClientId) -> )ENGINE=MyISAM; Query OK, 0 rows affected (0.67 sec)
Di bawah ialah pertanyaan untuk menukar jadual daripada MyISAM kepada INNODB -
mysql> alter table DemoTable ENGINE=InnoDB; Query OK, 0 rows affected (1.97 sec) Records: 0 Duplicates: 0 Warnings: 0
Sekarang mari kita semak status jadual -
mysql> show create table DemoTable;
Ini akan menghasilkan yang berikut output, yang akan dikemas kini Enjin muncul sebagai InnoDB -
+--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Table | Create Table | +--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | DemoTable | CREATE TABLE `DemoTable` (`ClientId` int(11) NOT NULL AUTO_INCREMENT, `ClientName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `ClientAge` int(11) DEFAULT NULL, `ClientCountryName` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL, `isMarried` tinyint(1) DEFAULT NULL, PRIMARY KEY (`ClientId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci | +--------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec)
Atas ialah kandungan terperinci Tukar jadual dari MyISAM ke INNODB dalam MySQL?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!