MySQL - changing table engine from innoDB to MyISAM?

MySQLMySQLi Database

Let us first create a table −

mysql> create table DemoTable1982
   (
   StudentId int
   ,
   StudentName varchar(20),
   StudentAge int
   );
Query OK, 0 rows affected (0.00 sec)

Let us check the table engine type -

mysql> show create table DemoTable1982;

This will produce the following output −

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table         | Create Table                                                                                                                                                                                                                         |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable1982 | CREATE TABLE `demotable1982` (`StudentId` int(11) DEFAULT NULL, `StudentName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `StudentAge` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Here is the query to change table engine from innoDB to MyISAM −

mysql> alter table DemoTable1982 ENGINE='MyISAM';
Query OK, 0 rows affected (0.00 sec)
Records: 0  Duplicates: 0  Warnings: 0

Let us check the table engine type now −

mysql> show create table DemoTable1982;

This will produce the following output −

+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table         | Create Table                                                                                                                                                                                                                           |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| DemoTable1982 | CREATE TABLE `demotable1982` ( `StudentId` int(11) DEFAULT NULL, `StudentName` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, `StudentAge` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci |
+---------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
raja
Published on 31-Dec-2019 12:33:54
Advertisements