Modify MySQL default character set, default engine

Source: Internet
Author: User

Cd/var/lib/mysql/game

ll

Vim db.opt


Default-character-set=utf8

Default-collation=utf8_general_ci


Wq


Service mysqld Restart

Or

Service Mysqld Reload


Default Character Set modification complete


Vim/etc/my.cnf


[Mysqld]

Datadir=/var/lib/mysql

Socket=/var/lib/mysql/mysql.sock

User=mysql

Default-storage-engine=innodb #添加该行 Set the default engine to InnoDB


Service mysqld Restart

Default Engine modification Complete


Mysql> show engines; #查看搜索引擎


Specify search engines and characters when you build a table

Mysql> CREATE TABLE T2 (id int) Engine=innodb default CharSet =utf8;



InnODB The engine supports many features:

a) support for ACID, simply to support transactional integrity, consistency;

b) support for row locks, as well as consistent reads like ORACLE, multiuser concurrency;

c) unique clustered index primary key design method, can greatly improve concurrent read and write performance;

d) support for foreign keys;

e) support crash data self-healing;


InnoDB for:

1. Applications that require transactions

2. Highly concurrent applications

3. Automatic recovery

4. Faster primary key-based operations


Need for attention issues

a) all InnoDB Data Sheets Create a non-business-independent, self-increment digital type as the primary key, which is very helpful to ensure performance;

b) to eliminate the use of Text/blob, do need to use, as far as possible to split out into a separate table;

c) Timestamp is recommended to use TIMESTAMP type storage;

d) IPV4 addresses are recommended to be stored in INT UNSIGNED type;

e) non-logical, such as gender, it is recommended to use TINYINT storage instead of CHAR (1);

f) storing longer text content, it is recommended to use json/bson format storage;


Modify MySQL default character set, default engine

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.