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

2 methods and precautions for adding scripts in HTML

How to add <script> script in HTML: 1. You c...

The best solution for resetting the root password of MySQL 8.0.23

This method was edited on February 7, 2021. The v...

Write a publish-subscribe model with JS

Table of contents 1. Scene introduction 2 Code Op...

The actual process of implementing the guessing number game in WeChat applet

Table of contents Function Introduction Rendering...

How to use Spark and Scala to analyze Apache access logs

Install First you need to install Java and Scala,...

How to use Docker to build enterprise-level custom images

Preface Before leaving get off work, the author r...

Summary of JavaScript Timer Types

Table of contents 1.setInterval() 2.setTimeout() ...

Native JS encapsulation vue Tab switching effect

This article example shares the specific code of ...

Vue imports Echarts to realize line scatter chart

This article shares the specific code of Vue impo...

About Zabbix forget admin login password reset password

The problem of resetting the password for Zabbix ...

A brief discussion on the maximum number of open files for MySQL system users

What you learn from books is always shallow, and ...

Oracle deployment tutorial in Linux environment

1. Environment and related software Virtual Machi...

Detailed tutorial on installing mysql 5.7.26 on centOS7.4

MariaDB is installed by default in CentOS, which ...

Full HTML of the upload form with image preview

The upload form with image preview function, the ...