Coding issues between MySQL and the server

Source: Internet
Author: User
Tags java web
1. Before practicing a Java Web project, MySQL encoding is set correctly, the server encoding is also set correctly, but when storing data to MySQL, there will be garbled problem, and later found that the MySQL and the server encoding Setup problem, the following is the MySQL directory, Copy My-default.ini the file, and named My.ini, so there are two. ini files in the root directory, one is My-default.ini, and the other is My.ini.

2. Next we just need to change the contents of the My.ini.

Add Character_set_server=utf8 under [mysqld], note that "UTF8" is not "utf-8" and there are no punctuation marks behind it;
Add three more lines after the phrase "sql_mode=no_engine_substitution,strict_trans_tables":
[Client]
port=3306
Default-character-set=utf8
[MySQL]
Default-character-set=utf8

Then look at the relevant code set for MySQL, show variables like "%char%";

Coding issues between MySQL and the server

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.