Home > Database > Mysql Tutorial > body text

What should I do if mysql source imports garbled characters?

藏色散人
Release: 2023-02-15 09:49:02
Original
2709 people have browsed it

Mysql source imports garbled solutions: 1. Use the "mysql -u guoxingege -p --default-character-set=utf8mb4" command to set the encoding; 2. Use "mysql -u guoxingege -p -- "default-character-set=utf8" command can be used to set the encoding.

What should I do if mysql source imports garbled characters?

The operating environment of this tutorial: Windows 10 system, MySQL version 5.7, Dell G3 computer.

What should I do if mysql source imports garbled characters?

MySQL uses the Source command to import Chinese garbled characters

Solution: add encoding

mysql -u guoxingege -p --default-character-set=utf8mb4
Copy after login

or

mysql -u guoxingege -p --default-character-set=utf8
Copy after login

other encoding customization## when logging in

#Press enter and enter the password

The following operations are nothing more than

use your database;

source /xx/xxx.sql;

Relevant expansion:

The mysql source command is mainly used to pour very large sql files. In daily work, we often encounter the situation of importing large data files. In MySQL, use mysql source Commands can be imported to easily solve this problem. The basic syntax of MySQL source is as follows:

mysql>use dbtest;
mysql>set names utf8;
mysql>source D:/xxx/xxx/back.sql;
Copy after login

First we select the database to which we need to import data, and then set the default characters. Set, then use the source command, followed by the absolute path where our .sql is located. If we have 5 files, we can pour them into the database one by one in this way. Remember to select the correct database name.

Recommended learning: "

MySQL Video Tutorial"

The above is the detailed content of What should I do if mysql source imports garbled characters?. 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