After doing the data migration, it is found that Japanese data is garbled through UI, and it is normal to modify Japanese directly through the UI.
After checking the information, the MySQL character set functions as follows:
MySQL Character set settings
• System Variables:
– character_set_server: Default internal operation character Set
–character_set_client: The character set used by the client source data
–character_set_connection: Connection Layer Character Set
–character_set_results: Query result Character Set
–character_set_database: The default character set for the currently selected database
–character_set_system: System metadata (field name, etc.) character set
– There are also variables that begin with Collation_ to describe the character Fu She.
So:
mysql> SHOW VARIABLES like ' collation_% ';
+----------------------+-----------------+
| variable_name | Value |
+----------------------+-----------------+
| collation_connection | Utf8_general_ci |
| Collation_database | Utf8_general_ci |
| Collation_server | Latin1_swedish_ci|
+----------------------+-----------------+
3 Rows in Set (0.00 sec)
The connection character set is established through the JDBC configuration, so there is no problem with the Japanese through the UI:
jdbc\:mysql\://10.1.0.198\:3306/mytestui?zerodatetimebehavior\=converttonull&useunicode\=true& Characterencoding\=utf-8
When importing data, MySQL uses the default character set for import operations, because the connection character set is not explicitly specified , and the default character set is latin1_swedish_ci:
Mysql-h127.0.0.1-umyaccount-p <./patch.sql
Solution 1:
Modify the system's default character set to Utf-8
Solution 2:
When importing SQL files, specify the character set:
mysql-h127.0.0. -umyaccount-p <.patch.sql --default-character-set=utf8
Mysql explain:
Use charset_name as the default character set for the client and connection.
A common issue that can occur when the operating system uses UTF8 or anothermulti-byte characterset are that output from th E MySQL client is formatted incorrectly, due tothe fact and the MySQL client uses the latin1 character set by default. Youcan usually fix such issues by using this option to force the client to use Thesystem character set instead
Mysql Import Japanese data garbled problem