In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "how to solve MySQL database garbled code problem". In the operation process of actual cases, many people will encounter such difficulties. Next, let Xiaobian lead you to learn how to deal with these situations! I hope you can read carefully and learn something!
Add charset setting when creating database/table
1. Building a library
2. Table construction
client display
locale
Confirm whether the locale setting is UTF8 mode. Generally, there is no problem on the server side, but only on the client side. Or some clients have problems, often there are problems with client display settings.
mysql setup
Use show variables like ' %character%' to confirm that modifying character_set_database and character_set_server in general can modify settings only in the current session
Use mysql command to set character set within session scope
1. Local settings
It only works in the current session and is set as follows:
2. Global settings
Multiple sessions function in the following ways:
Of course, session mode will be invalid after database restart, and it needs to be persisted. The same settings should be set in mysql's configuration file my.cnf.
In this way, when creating a database or database table, the default is the specified utf8
If it is purely a display problem, it is also likely that character_set_results is set to display in many cases.
Use show variables like ' %character%' to confirm, and if the settings are incorrect, resolve them as follows
database data export import
1. Database data export
Database export using mysqldump generally uses the following command
If garbled, you can add the following Option
mysqldump -u username-p user password--default-character-set=utf8 database name> mysqlbackup.sql
If you have blob types, you need to export mysqldump using the hex-blob option
2. Database data import
If there is a problem when importing, you can also consider adding character level settings.
mysql -u user name-p user password--default-character-set=utf8 database name
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.