How to import Chinese garbled characters to mysql source

Source: Internet
Author: User

Today, I export a file from windows. the SQL file is expected to be imported to linux's unbutn again. Next I will introduce you to some friends who need to know how to import Chinese garbled characters in source.

Error Message

All Chinese characters are garbled.

Solution
 

Query mysql settings
Mysql> s
--------------
C: Program FilesMySQLMySQL Server 5.0binmysql.exe Ver 14.12 Distrib 5.0.67,
For Win32 (ia32)
Connection id: 1
Current database: common
Current user: root @ localhost
SSL: Not in use
Using delimiter :;
Server version: 5.0.67-community-nt MySQL Community Edition (GPL)
Protocol version: 10
Connection: localhost via TCP/IP
Server characterset: utf8
Db characterset: utf8
Client characterset: utf8
Conn. characterset: utf8
TCP port: 3306
Uptime: 1 min 23 sec
Threads: 1 Questions: 14 Slow queries: 0 Opens: 13 Flush tables: 1 Open tab
Les: 7 Queries per second avg: 0.169


When exporting the mysql SQL Execution file, specify the encoding format:

The Code is as follows: Copy code

 
Mysqldump-uroot-p -- default-character-set = utf8 mo (dbname)> E: // xxxx. SQL

The import is OK.
 

Run the following command:

The Code is as follows: Copy code

 
Mysql-u root-p -- default-character-set = utf8

Use dbname

Source/root/newsdata. SQL

Note: If you are using gbk, we only need to set it to gbk. It depends on the database code found above.

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.