Home > Database > Mysql Tutorial > body text

What to do if garbled characters appear when importing data into MYSQL

coldplay.xixi
Release: 2020-10-26 15:40:11
Original
5879 people have browsed it

Solution to garbled characters when MYSQL imports data: 1. Solve the problem by modifying the parameters in [my.ini] in the mysql installation file Solve the garbled code problem; 2. Import the garbled code on the command line to solve the problem; 3. Paste the code in the sql file directly; 4. Use Notepad or other text tools To change the encoding format of SQL files.

What to do if garbled characters appear when importing data into MYSQL

Solution to garbled characters when importing data into MYSQL:

First create a new database with the same name in the mysql operation tool , when encoding utf-8 to create a new database, you must pay attention to generating the original database phase. The same encoding form,

Method 1: By modifying the parameter –default-character-set in my.ini in the mysql installation file = utf8 Solve the garbled code problem

[mysql]
default-character-set=utf8
Copy after login

Method 2: Import the garbled code problem on the command line

1.use database_name;

2.set names utf8; (or other required encoding)

3. source example.sql (sql file storage path)

Method three: Paste the code in the sql file directly (recommended to use , this is how I achieved it)

1. Open the SQLyog client software;

2. Locate the SQL editor, and then use Notepad to open the SQL file just exported;

3. Copy all the SQL statements in the file to the SQL editor and execute these SQL codes;

Method 4: Use Notepad or other text tools to change the encoding format of the SQL file ( If method three does not work, then Just try method four)

1. Use Notepad (or UE) to open the exported SQL file;

2. Save this file - open the Save As dialog box and select the dialog box The encoding format in is UNICODE encoding;

3. Save the file, then CTRL A, select all;

4. Copy the SQL statement inside to the "SQL Coder" in SQLyog. Execute the SQL statement again;

5. Refresh the database after the execution is completed

More related free learning recommendations:mysql tutorial(video)

The above is the detailed content of What to do if garbled characters appear when importing data into MYSQL. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!