In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail the method of changing mysql character coding for you. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Mysql command line modifies character encoding
1. Modify the database character encoding
Mysql > alter database mydb character set utf8
2. Specify the character encoding of the database when creating the database
Mysql > create database mydb character set utf8
3. Check the character encoding of mysql database
Mysql > show variables like 'character%' / / query the character encoding of all attributes of the current mysql database +-+ | Variable_name | Value | +- -+-+ | character_set_client | latin1 | | character_set_connection | latin1 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | latin1 | | character_set_server | utf8 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-+-+ |
4. Modify the character encoding of mysql database
To modify the character encoding, you must modify the mysql configuration file my.cnf, and then restart to take effect.
You usually need to modify my.cnf in the following areas:
[client] next, add default-character-set=utf8, or character_set_client=utf8
[mysqld] next, add character_set_server = utf8
Because of the above configuration, mysql defaults to latin1, and if it is only through the command line client, mysql will not work after restart.
The following is the way to modify the client command line, which is not recommended
Mysql > set character_set_client=utf8; mysql > set character_set_connection=utf8; mysql > set character_set_database=utf8; mysql > set character_set_database=utf8; mysql > set character_set_results=utf8; mysql > set character_set_server=utf8; mysql > set character_set_system=utf8; mysql > show variables like 'character%' +-- +-- + | Variable_name | Value | +-- -+ | character_set_client | utf8 | | character_set_connection | utf8 | | character_set_database | utf8 | | character_set_filesystem | binary | | character_set_results | utf8 | | character_set_server | Utf8 | | character_set_system | utf8 | | character_sets_dir | / usr/share/mysql/charsets/ | +-- +-- + 8 rows in set (0.00 sec) about This is the end of mysql's method of changing character coding. I hope the above content can be of some help to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.