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

Thumbnail hover effect implemented with CSS3

Achieve resultsImplementation Code html <heade...

How to remove inline styles defined by the style attribute (element.style)

When modifying Magento frequently, you may encount...

How to use HTML+CSS to create TG-vision homepage

This time we use HTML+CSS layout to make a prelim...

Using jQuery to implement the carousel effect

This article shares the specific code for impleme...

How to completely uninstall node and npm on mac

npm uninstall sudo npm uninstall npm -g If you en...

Linux uses lsof command to check file opening status

Preface We all know that in Linux, "everythi...

Analysis of the principle of Vue nextTick

Table of contents Event Loop miscroTask (microtas...

New ways to play with CSS fonts: implementation of colored fonts

What if you designers want to use the font below ...

Implementation steps for docker deployment of springboot and vue projects

Table of contents A. Docker deployment of springb...

MySQL table type storage engine selection

Table of contents 1. View the storage engine of t...

Detailed explanation of MySQL 5.7.9 shutdown syntax example

mysql-5.7.9 finally provides shutdown syntax: Pre...

Node+Express test server performance

Table of contents 1 Test Environment 1.1 Server H...

css add scroll to div and hide the scroll bar

CSS adds scrolling to div and hides the scroll ba...