First, create a database
Create and display a database that already exists.
CREATE DATABASE MySQLdb; SHOW DATABASES;
Second, delete the database
Deletes and displays the database that already exists.
DROP DATABASE MySQLdb; SHOW DATABASES;
Third, the database storage engine
The storage engine refers to the type of table, the storage engine of the database determines how the table is stored on the computer, and can choose different storage methods depending on the requirements.
When you create a table, InnoDB is selected by default if you do not specify a default storage engine.
- The InnoDB engine supports auto-grow columns and foreign keys, the table structure is stored in the frm file, and the data and the lasso are stored in the table spaces defined by Innodb_data_home_dir and Innodb_data_file_path. The advantage lies in providing good transaction management, crash repair ability and concurrency control, the disadvantage is that the reading and writing efficiency is slightly poor, occupy data space is large.
- The table structure of the MyISAM engine is stored in the frm file, the data is stored in the MyD file, and the lasso is stored in the Myi file. The advantage is the small footprint, fast processing speed, the disadvantage is that transaction integrity and concurrency are not supported.
- The memory engine creates tables using content that is stored in the contents, except that the table structure is stored in the frm file, and the rest of the data is stored in memory. This helps to improve the efficiency of the table, freeing the memory or deleting the table when it is no longer needed.
MySQL Notes: Database operations