For MySQL import garbled settings

Source: Internet
Author: User

For cases where the database is garbled, first look at the database encoding

1. View Database encoding

2, set the connection code

The encoding of the server, database, and data table sections is set, and the connection encoding must be set. The connection encoding settings are as follows: mysql> set character_set_client= ' UTF8 ';
mysql> SET character_set_connection= ' UTF8 '
mysql> SET character_set_results= ' UTF8 '
Set the connection code, the following can be successfully inserted in Chinese: mysql> insert INTO mysqlcode values (null, ' Java enthusiasts ');
Query OK, 0 rows affected (0.02 sec)
In fact, the above three commands to set the connection code can be simplified to one: mysql> set names ' UTF8 '; Note: The above UTF8 is based on your database encoding settings, if the database is GBK, then modify to GBK can! 3, complete the execution of the SQL statement, note that this is performed here on the "mysql>" command line if you want to execute it at the command line [[email protected] mqc]#: [[email protected] mqc]# Mysql-uroot- P --default-character-set=utf8 dbname < Dbname.sql

For MySQL import garbled settings

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.