Mysql storage engine and data type (ii) _mysql

Source: Internet
Author: User

Storage Engine:
1. View Supported storage engines:
show Engines \g;
Show variables like ' have% ';
2. View the default storage engine:
Show variables like ' storage_engine% ';
3. Modify the default storage engine:
① installation can be done by using the wizard:
"Start"-> "->" mysql-> "MySQL Server 5.5"-> "MySQL server Instance Configuration Wizard" into the graphical Instance Configuration Wizard Welcome page. In the graphical Instance Configuration Wizard, select click the Next button to enter the MySQL select Use Type, where the default storage engine is InnoDB if the multifunctional Database radio button is selected. If you select the Non-transaction Database only radio button, the storage engine is MyISAM by default.
② installation version or free version another way to modify the default engine:
Open the My.ini configuration file and add a configuration to the contents of the [mysqld] group Default-storage-engine=innodb

Data type:
The database management system provides integer type, floating-point type and fixed-point number type and bit type, date and time type, String type.

1. Integer type:
tinyint (1 bytes) smallint (2 bytes) mediumint (3 bytes) int and integer (4 bytes) bigint (8 bytes)
If you cannot differentiate the range of representations for each integer, you can help view the information by looking at the MySQL system.
mysql> Help Contents;
mysql> help Data Types;
mysql> help int;

2, floating-point type, fixed-point number type, bit type:
• Floating-point number type: Float (4 bytes) double (8 bytes) If you need to be accurate to more than 10 digits after the decimal point, you need to select double
• fixed-point number type: Dec (m,d) (m+2 byte) decimal (m,d) (m+2 bytes)
Require decimal precision is very high when selected, usually represents the amount of preference for decimal
• Bit type: bit (1-8 bytes)
Note: The total length of decimal (18,4) is 18 bits, including 1-bit decimal points and 4-bit decimals, that is, the 18-1-4=13 integer bit is only 13-bit M: Total lengths D: Number of digits in decimal

3, Date and time type:
data (4 bytes)
datatime (8 bytes)
timestamp (4 bytes)
time (3 bytes)
year (1 bytes)
Each date and time data type has a range of values, and if the inserted value exceeds the range of that type, the default value is inserted.
• If you want to indicate the date, you will typically use the date
• If you want to indicate the time of day and the minute, usually use datetime
• If you need to insert or update the current system time frequently, you will typically use the timestamp type
• If you want to represent minutes, you will typically use time
• If you want to represent the year, you will typically use the years, because the type takes up less space than date.

4. String type:
Char Series string:
Integer between char (m) m bytes m 0-255
The integer length between the varchar (m) m byte m is 0-65535 is variable
Note: UTF-8: one chinese character = 3 bytes, English is a byte; GBK: one kanji = 2 bytes, English is a byte

Text Series String Type:
tinytext (0-255 bytes)
text (0-65535 bytes)
mediumtext (0-167772150 bytes)
longtext (0-4294967295 bytes)

Binary Series String Type:
binary (m) m is a byte allowed length of 0-m
varbinary (m) m is a byte allowed length of 0-m

Note: These two and the preceding char and varchar types, the difference being char, which stores character data, binary can store binary data (Pictures, music, video)
BLOB series String Type:
Tinyblob 0-255 bytes
blob 0-2 of the 16-time party
Mediumblob 0-2 of the 24-time party
Longblob 0-2 of the 32-time party
Note: This group and text type, the difference is that this group can store binary data (Pictures, music, video), a group of text can only store character data

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Related Article

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.