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.
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
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!