4th Chapter Database Basic Operation __ Database

Source: Internet
Author: User
Tags table definition create database
4.1 Creating a database

After the MySQL installation is complete, the system automatically creates several default databases, which are stored in the data directory.
Database query statement: Show DATABASES #分号不能少, Windows command equivalent to show databases;,linux not equivalent
Database creation is the partitioning of a zone on a system disk to store and manage data, an administrator can create databases for users, and users who are assigned permissions can create databases themselves. The basic syntax format for creating a database in MySQL is as follows:
CREATE DATABASE database_name;
Where database_name is the name of the database that will be created and cannot have the same name as the database that already exists.
To view the created database database_name command:
Show CREATE DATABASE database_name; 4.2 Deleting a database

is to purge the existing database from disk space, along with all data in the database. The basic syntax is as follows:
DROP DATABASE database_name;
Where database_name is the name of the database to be deleted, and if the specified database name does not exist, an error is removed. 4.3 database storage engine

The database storage engine is the component of the database's underlying software, and the database management system (DBMS) uses the data engine to create, query, update, and delete data operations. Many different database administrations now support a variety of data engines. The core of MySQL is the storage engine. 4.3.1 MySQL 5.7 supported storage engines

MySQL provides a number of different storage engines, including the engine that handles the transaction security table and the engine that handles the non-transactional security table. In MySQL, you do not need to use the same storage engine throughout your server, and you can use a different storage engine for each table for specific requirements.
You can use the show engines statement to view the types of engines supported by your system. 4.3.2 InnoDB Storage Engine

is the preferred engine for transactional databases, supports transaction security tables (ACID), supports row locking and foreign keys, and InnoDB as the default storage engine after MySQL 5.5.5. 4.3.3 MyISAM Storage Engine

MyISAM is based on the ISAM storage engine and expands it. It is one of the most commonly used storage engines in the Web, data warehousing, and other application environments. MyISAM has a high access, query speed, but does not support transactions. In the version before MySQL 5.5.5, MyISAM is the default storage engine.
Creating a database using the MyISAM engine generates 3 files. The file name begins with the name of the table, and the extension indicates the file type: The storage table definition file has an extension of frm and the data file has an extension of. MyD (MYData), the extension of the index file is. Myi (Myindex). 4.3.4 Memory Storage Engine

The memory storage engine stores the data in the table in the content, providing quick access to queries and referencing other table data. 4.3.5 Select Storage Engine

Each storage engine has its own characteristics to accommodate different requirements.
InnoDB is a good choice if you are required to provide transaction security capabilities for submission, rollback, and crash recovery and require concurrency control. If the data table is used primarily for inserting and querying records, the MyISAM engine can provide high processing efficiency. If the data is only temporarily stored, the amount of data is small, and do not require high data security, you can choose to save the data in memory of the memory engine. If you have only insert and select operations, you can select the archive engine, which supports high concurrent inserts, but is not inherently transaction-safe. The archive storage engine is ideal for storing archived data.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.