Innodb và myisam

ContentsWhat are MyISAM and InnoDBMyISAM vs. InnoDB Main DifferencesHow to lớn Cheông xã if You Are Using MyISAM or InnoDBChechồng Using phpMyAdminHow lớn Convert MyISAM and InnoDBConvert Storage Engine Using phpMyAdmin
ContentsWhat are MyISAM and InnoDBMyISAM vs. InnoDB Main DifferencesHow to Check if You Are Using MyISAM or InnoDBCheck Using phpMyAdminHow khổng lồ Convert MyISAM & InnoDBConvert Storage Engine Using phpMyAdmin

Introduction

Choosing the right storage engine is a crucial strategic decision that impacts future development. Depending on your use case, decide between two main storage engines for MySquốc lộ – MyISAM or InnoDB.

Bạn đang xem: Innodb và myisam

In this article, you will learn the main differences between MyISAM và InnoDB storage engines, how lớn kiểm tra which storage engine you are using and how to lớn convert it.


*
*
*
*

Running a Query

Another way khổng lồ display a mặc định storage engine is to lớn run a query.

1. Log in to lớn phpMyAdmin & select the preferred database from a database list.

2. Select the SQL tab to access query options.

3. Enter the following command khổng lồ display all tables using MyISAM as a storage engine:

SELECT TABLE_NAME, ENGINE FROM information_schema. TABLES WHERE TABLE_SCHEMA = ‘database_name’ và ENGINE = ‘myISAM’4. Cliông chồng Go to lớn run a query.


Note: Replace database_name with the name of your database.

The output displays a danh sách of all tables containing the MyISAM storage engine.


You can use the same commvà lớn find databases using the InnoDB storage engine. Modify the query by replacing ENGINE = ‘myISAM’ with ENGINE = "InnoDB".

How to Convert MyISAM và InnoDB

Problems can occur if you use InnoDB in everyday processes, while an older table uses MyISAM. That is why it is essential lớn know how to convert tables.

Convert Storage Engine via Terminal

Run the ALTER TABLE command in the MySquốc lộ shell to lớn convert the storage engine from MyISAM to InnoDB and vice versa.

Xem thêm: Mơ Thấy Họ Hàng Thì Đánh Con Gì Cho Chuẩn Xác? Nằm Mơ Thấy Họ Hàng Có Ý Nghĩa Gì

To convert InnoDB to MyISAM, run:

ALTER TABLE database_name.table_name ENGINE=MyISAM;To convert MyISAM to lớn InnoDB, run:ALTER TABLE database_name.table_name ENGINE=InnoDB;The terminal prints out a confirmation message.


Convert Storage Engine Using phpMyAdmin

There are two ways to convert the storage engine in phpMyAdmin:

Using the Table Operations thực đơn.Running a query.Using the Operations Menu

1. Select the preferred database from a database thực đơn.

2. Choose a table for which you want lớn modify the storage engine & select the More drop-down menu.

3. Clichồng Operations to lớn access the menu.


4. Locate the Storage Engine setting in the Table options & click the storage engine khổng lồ load the drop-down menu containing various storage engines. Select InnoDB from the list & clichồng GO lớn save the change.


Running a Query

1. Access the SQL comm& center for the preferred database.

2. Run the ALTER TABLE command in the MySQL shell lớn convert the storage engine.

To convert khổng lồ MyISAM, run:

ALTER TABLE table_name ENGINE=MyISAM;To convert to InnoDB, run:

ALTER TABLE.table_name ENGINE=InnoDB;3. Clichồng the GO button to run the query.


You have successfully converted the storage engine.

Conclusion

After reading this article, you should better understvà the differences between MyISAM & InnoDB storage engines. Knowing the differences helps you choose the storage engine that fits your needs the most.

Xem thêm: Nghĩa Của Từ Secretary General Là Gì Trong Tiếng Việt? General Secretary Trong Tiếng Tiếng Việt

You have sầu also learned how lớn kiểm tra the storage engine và how khổng lồ convert it if needed.