In MySQL, database garbled characters can generally be fixed by setting the character set, but garbled characters can appear at various stages, so this article summarizes the various stages of garbled characters and the corresponding methods. Add charset settings when creating a database/table Building a database Create a table Client display locale Check whether the locale setting is UTF8. Generally, there is no problem on the server side, only on the client side. Or there may be problems with some clients, which is often caused by problems with the client display settings.
mysql settings Use show variables like '%character%' to confirm. Generally, modifying character_set_database and character_set_server can only modify the settings in the current session. Use the mysql command to set the character set within the session
Local settings It only works in the current session. The setting method is: Global Settings The setting method for multiple sessions to work is: Of course, the session mode will become invalid after the database is restarted, and needs to be persisted. The same setting can be set in the MySQL configuration file my.cnf. In this way, when creating a database or creating a database table, utf8 is specified by default. If it is a pure display problem, it may often be due to the character_set_results setting. Use show variables like '%character%' to confirm. If the setting is incorrect, you can use the following method to solve it Database data export Generally, the following command is used to export the database using mysqldump If garbled characters appear, you can add the following Option If it contains blob type, you need to use the hex-blob option to export mysqldump Database data import If there are problems when importing, you can also consider adding character-level settings You can also use the following method and execute the following command before importing Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. If you want to learn more about this, please check out the following links You may also be interested in:
|
<<: Detailed explanation of the new features of ES9: Async iteration
>>: Detailed explanation of common commands for network configuration of containers in Docker
Redux is a simple state manager. We will not trac...
Table of contents 1. Trigger Introduction 1. What...
Table of contents 1. Overview 2. Django Project 3...
1. Use version vite:2.0 ant-design-vue: 2.0.0-rc....
Recently, I plan to deploy a cloud disk on my hom...
Let's take a look at the problem of VScode re...
background: 1. There is a notification table in t...
1. The first method is to use the unhup command d...
1. Cancel the dotted box when the button is press...
1. Problem Description When starting MYSQL, a pro...
Personal implementation screenshots: Install: npm...
In actual web page development, accordions also a...
Table of contents 1. In project development, the ...
Preface This article mainly introduces the releva...
1. Previous versions yum remove docker docker-cli...