Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How do I view the current storage engine of MySQL?

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

In general, mysql provides a variety of storage engines by default, which you can view by:

See what storage engine your mysql now offers:

Mysql > show engines

Take a look at your mysql's current default storage engine:

Mysql > show variables like'% storage_engine%'

You need to see which engine is used for a table (the storage engine currently used for the table is indicated by the parameter engine in the display results):

Mysql > show create table table name

How to view the version on the Mysql server

Uh, system function.

Select version ()

The code is handsome.

What is the difference between the three storage engines of Mysql database?

This is to consider the issue of performance, as well as transaction support, Baidu you will know.

MyISAM, InnoDB, Heap (Memory), NDB

It seems that InnoDB is generally used.

Mysql storage engines include: MyISAM, InnoDB, BDB, MEMORY, MERGE, EXAMPLE, NDBCluster, ARCHIVE, CSV, BLACKHOLE, FEDERATED and so on. InnoDB and BDB provide transaction security tables, while other storage engines are non-transaction security tables.

The two most commonly used storage engines:

1.Myisam is the default storage engine for Mysql. When create creates a new table, Myisam is used by default when the storage engine for the new table is not specified. Each MyISAM is stored as three files on disk. The file name is the same as the table name, with .frm (storage table definition), .MYD (MYData, storage data), and .MYI (MYIndex, storage index). Data files and index files can be placed in different directories, evenly distributed io, for faster speed.

The 2.InnoDB storage engine provides transaction security with commit, rollback, and crash recovery capabilities. But compared to Myisam's storage engine, InnoDB writes are less efficient and take up more disk space to retain data and indexes.

I don't know if it will help you.

Thank you for the questioner's comments!

=

Modify the default storage engine for mysql

1. View mysql storage engine commands

Enter show engines at the mysql > prompt

Field Support: Default indicates the default storage engine

Www.2cto.com

2. Set InnoDB as the default engine:

Add under [mysqld] in the configuration file my.cnf

Default-storage-engine=INNODB one sentence

3. Restart the mysql server:

Mysqladmin-u root-p shutdown

Or service mysqld restart logs in to the mysql database

Storage engine for MySQL to view and modify tables

1 View the storage engines supported by the system

Show engines

2 View the storage engine used by the table

There are two ways:

A 、 show table status from db_name where name='table_name'

B 、 show create table table_name

If the format displayed is not good-looking, you can use\ g instead of the end-of-line semicolon

Some people say that the second method is not accurate. I tried. After shutting down the original default Innodb engine, I could not execute the show create table table_name instruction at all, because the Innodb table was built before, and the MyISAM engine was used by default after turning it off, so that the Innodb table data could not be read correctly.

3 modify the method of table engine

Alter table table_name engine=innodb

4 method of shutting down Innodb engine

Turn off the mysql service: net stop mysql

Locate the my.ini file in the mysql installation directory:

Find default-storage-engine=INNODB and change it to default-storage-engine=MYISAM

Find # skip-innodb and change it to skip-innodb

Start the mysql service: net start mysql

Dimensions:

If it is MyISAM, the backup data only needs to back up the data in the library corresponding to the data in the corresponding directory of mysql.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report