Solve the Problem of garbled Characters During mysql import and Restoration

Source: Internet
Author: User
Tags mysql import

Solution:
Step 1: the database and table created during restoration are in utf8 format (utf8 is recommended, of course, either gbk or gb2312)

Copy codeThe Code is as follows:
Create database 'shegongku 'default character set utf8
Create table 'members '(
'Uid' mediumint (8) unsigned not null default '0 ',
'Username' varchar (15) not null default '',
'Password' varchar (40) not null default '',
'Salt' varchar (16) default NULL,
'Email 'varchar (60) not null default''
) ENGINE = MyISAM default charset = utf8;


Second, convert the encoding of the SQL file to utf8 format. You can use notepad2 or UltraEditor to convert the file, and then add a set names utf8 row to the first SQL file to save the file.

Part 3: import. In general, there will be no garbled characters. If you find the garbled characters again in the terminal cmd, this is not a database problem, but a display problem. Enter set names gbk in the terminal, in this way, Chinese characters are displayed normally.

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.