Modify the default storage engine and encoding of the MySQL database

Source: Internet
Author: User

 

The following operations are tested in MySQL 5 on Windows XP

Now I have changed the storage engine MyISAM to InnoDB and renamed the encoding utf8 as an example.

1. Open the MySQL configuration file named my. ini.

Add the following content under [mysqld:

Default-storage-engine = InnoDB

Character_set_server = utf8

Init_connect = 'set names utf8'

Add the following to [client:

Default-character-set = utf8

Restart MySQL Service

 

2. Use commands

(1) view the current encoding \ s;

The above four codes are both gb2312 and can be entered in Chinese.

(2) If not, modify the Encoding

Set names gb2312; -- change the next two

Set character_set_server = gb2312;

Set character_set_database = gb2312;

Then execute:

Set collation_server = gb2312_chinese_ci

Set collation_database = gb2312_chinese_ci

Set collation_connection = gb2312_chinese_ci

 

Go to the command line to start the MySQL tool and view the storage engine and encoding respectively.

Mysql> show variables like '% storage_engine % ';

Mysql> show variables like 'character _ SET _ % ';

Compare before and after the restart to see if it has taken effect

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.