Setting the engine MyISAM/InnoDB when creating a data table in MySQL

Setting the engine MyISAM/InnoDB when creating a data table in MySQL

When I configured mysql, I set the default storage engine in the configuration file to InnoDB. Today I checked the difference between MyISAM and InnoDB. In the seventh article, "MyISAM supports GIS data, but InnoDB does not. That is, MyISAM supports the following spatial data objects: Point, Line, Polygon, Surface, etc."

As a student majoring in geographic information systems (actually surveying and mapping), a database that can store spatial data is a good database. Please forgive me for being a database novice.

There are three ways to configure the database engine:

(1) Modify the configuration file

Open the my.int configuration file in ~\MySQL\mysql-5.6.31-winx64 in the installation directory, and modify or add the following statement after [mysqld] (if you have not set it before):

default-storage-engine=INNODB

I will change it to MyISAM myself, and when you create a data table in the future, the default engine will be the current setting.

(2) Declare when creating a data table

mysql> create table test(
 -> id int(10) unsigned not null auto_increment,
 -> name varchar(10) character set utf8,
 -> age int(10),
 -> primary key(id)
 -> )
 -> engine=MyISAM
 -> ;

The above statements are for creating a table, as shown in the figure below. There is nothing to say.

Next, query the engine category of the created table.

show create table test;

(3) Change the engine of the data table

The engine type of a data table is not fixed. You can modify it through visual applications such as Navicat for MySQL, or through commands. Now change the engine of the newly created test table to InnoDB.

alter table test engine=innodb;

Additional knowledge: MySQL changes the data engine of all tables, MyISAM is set to InnoDB

1. Set up the SQL statement to execute first:

SELECT GROUP_CONCAT(CONCAT( 'ALTER TABLE ' ,TABLE_NAME ,' ENGINE=InnoDB; ') SEPARATOR '' ) 
FROM information_schema.TABLES AS t 
WHERE TABLE_SCHEMA = 'database' AND TABLE_TYPE = 'BASE TABLE';

Change the database to your database name. Here I assume my database is database

SELECT GROUP_CONCAT(CONCAT( 'ALTER TABLE ' ,TABLE_NAME ,' ENGINE=InnoDB; ') SEPARATOR '' ) 
FROM information_schema.TABLES AS t 
WHERE TABLE_SCHEMA = 'database' AND TABLE_TYPE = 'BASE TABLE';

2. Get a very long SQL, copy and execute it

3. View the field storage information of the current database

SHOW TABLE STATUS FROM database;

result:

The above article about setting the engine MyISAM/InnoDB when creating a data table in MySQL is all the content that the editor shares with you. I hope it can give you a reference. I also hope that you will support 123WORDPRESS.COM.

You may also be interested in:
  • Introduction to MySQL isolation level, lock and MVCC
  • Summary of the differences between MySQL storage engines MyISAM and InnoDB
  • Comprehensive analysis of optimistic locking, pessimistic locking and MVCC in MySQL
  • Detailed explanation of memory management of MySQL InnoDB storage engine
  • Detailed explanation of various locks in the InnoDB storage engine in MySQL
  • Detailed explanation of the data page structure of MySQL's InnoDB storage engine
  • MySQL storage engines InnoDB and MyISAM
  • MYSQL database Innodb engine mvcc lock implementation principle

<<:  Detailed explanation of the solution to Tomcat's 404 error

>>:  JS realizes the effect of picture waterfall flow

Recommend

js to implement collision detection

This article example shares the specific code of ...

Implementation of nginx worker process loop

After the worker process is started, it will firs...

Mini Program to Implement Paging Effect

This article example shares the specific code for...

mysql subquery and join table details

Table of contents 1. What is a subquery? 2. Self-...

How to use MySQL common functions to process JSON

Official documentation: JSON Functions Name Descr...

HTML+CSS makes div tag add delete icon in the upper right corner sample code

1. Requirements description Display the delete ic...

Add a floating prompt for the header icon in the ElementUI table

This article mainly introduces how to add floatin...

Detailed tutorial on integrating Apache Tomcat with IDEA editor

1. Download the tomcat compressed package from th...

HTML Marquee character fragment scrolling

The following are its properties: direction Set th...

Undo log in MySQL

Concept introduction: We know that the redo log i...

About the pitfalls of implementing specified encoding in MySQL

Written in front Environment: MySQL 5.7+, MySQL d...

Example of how to quickly delete a 2T table in mysql in Innodb

Preface This article mainly introduces the releva...