Mysql-set encoding

Source: Internet
Author: User
Tags mysql command line

You can add the following points if you have any better solutions.

Modify the my. ini configuration file under the MySQL installation directory

One location is under the [client] label. Change this location to default-character-set = gutf8 to change the user's default encoding. The second part is located under the [mysqld] label and changed to default-character-set = utf8

Enter the following command in the MySQL command line:

Set characterSetClient = utf8;
Set characterSetConnection = utf8;
Set characterSetDatabase = utf8;
Set characterSetResults = utf8 ;/It is useful here./
Set characterSetServer = utf8;
However, after the restart, the encoding settings are restored.

Creating a database or table

Add the encoding ID, for example, create databaseTest2Default Character Set utf8 collate utf8GeneralThe specified library is UTF-8 encoded.
In phpMyAdmin, directly select utf8GeneralCi
You can also encode the strap when creating a table, for example, create table abc (...;) charset = utf8;

During development in other languages, note that the database connection must be consistent with the database encoding.

For example, in Java, JDBC: mysql: // 192.168.0.5: 3306/test? Characterencoding = utf8
Set the encoding to utf8.

Currently, I can only write so much data.

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.