PrefaceEvery time I use the terminal to create a database or table, the character set is latin1, or when inserting values, garbled characters are displayed (when the character set is not specified) as follows: View the character set of the current databasecharacter_set_client: The character set of the client request data character_set_connection: Character set for client/server connections character_set_database: The character set of the default database. This character set is used regardless of how the default database is changed. If there is no default database, the character set specified by character_set_server is used. It is recommended that this variable be managed by the system itself and not defined manually. character_set_filesystem: Convert the file name on the OS to this character set, that is, convert character_set_client to character_set_filesystem. The default binary does not perform any conversion. character_set_results: result set, character set returned to the client character_set_server: The default character set of the database server character_set_system: System character set. This value is always utf8 and does not need to be set. This character set is used for the names of database objects (such as tables and columns), and also for the names of functions stored in catalog tables. View the collation rules of the current databaseshow variables like 'collation%'; In the parameter file, the utf8mb4 character set is set in client, mysql, and mysqld, but the collation related parameters are not set collation_connection The character set of the current connection. collation_database The default collation for the current date. The value of this variable changes every time you use the USE statement to "jump" to another database. If there is no current database, the value of this variable is the value of the collation_server variable. collation_server The default collation for the server. The naming rule of the sorting method is: character set name_language_suffix, where the meanings of each typical suffix are as follows: 1) _ci: case-insensitive sorting 2) _cs: case-sensitive sorting 3) _bin: Binary sorting method. The size comparison will be based on the character encoding and does not involve human language. Therefore, the sorting method of _bin does not include human language. Add the following to the parameter file [mysqld]
Perform a test after restarting the database. After a series of tests, the modification was successful. Therefore, during installation, parameters must be modified. It is impossible to compile the database after installation. If the database cannot be restarted during production, in addition to creating each table and hard-coding the database, you can only temporarily specify the character set. Temporary designation: SET character_set_client = utf8mb4; SET character_set_connection = utf8mb4; SET character_set_database = utf8mb4; SET character_set_results = utf8mb4; SET character_set_server = utf8mb4; SummarizeThis is the end of this article about MYSQL character set settings (terminal character set). For more relevant MYSQL character set settings (terminal character set) content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: A brief discussion on the role of the docker --privileged=true parameter
>>: XHTML Getting Started Tutorial: XHTML Hyperlinks
React is a JAVASCRIPT library for building user i...
I was curious about how to access the project usi...
Related articles: Install Docker using yum under ...
First of all, you need to understand why you use ...
1. Regular expression matching ~ for case-sensiti...
GUN Screen: Official website: http://www.gnu.org/...
1- Styling dropdown select boxes - Modify the dro...
The specific code of JavaScript date effects is f...
After getting used to VM, switching to BOX is a l...
1. Import the basic style of external CSS files U...
This article mainly introduces the sample code of...
Click here to return to the 123WORDPRESS.COM HTML ...
Preface The so-called fuzzy query is to provide q...
This article shares the specific code of jQuery t...
Through an example, I shared with you the solutio...