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--
Mysql how to set the default character encoding, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
Default character encoding settings for mysql with MySQL basic configuration (my.ini sets character encoding)
The default encoding of MySQL is Latin1, which does not support Chinese, so how to modify the default encoding of MySQL? let's take setting UTF-8 as an example.
The default encoding of MySQL is Latin1, and Chinese is not supported. How to modify the default encoding of MySQL? let's take UTF-8 as an example.
It should be noted that there are a lot of changes to be made, and there are also many ways to modify them. Here is one of the simplest and most thorough ways:
1. Under the Windows system
1. Abort MySQL service
2. Find my.ini in the installation directory of MySQL. If not, copy my-medium.ini to a my.ini.
3. After opening my.ini, add default-character-set=utf8 under [client] and [mysqld], save and close (add in mysqld if you make an error, you can try
Character-set-server=utf8)
4. Start the MySQL service
II. Under the Linux system
1. Abort MySQL service (bin/mysqladmin-u root shutdown)
2. Find my.cnf under / etc/. If not, copy the my-medium.cnf under the support-files directory under MySQL's installation directory to / etc/ and rename it to my.cnf.
3. After opening my.cnf, add default-character-set=utf8 under [client] and [mysqld], save and close
4. Start the MySQL service (bin/mysqld_safe &)
It is very simple. This modification is done once and for all. In the future, all the default codes related to MySQL will be UTF-8. When creating a new table, you do not need to set it again.
It should be noted that the existing data in the database still retains the existing coding method, so you need to transcode yourself. There are many methods on the Internet, so I won't repeat them.
Note: if it is in a higher version of MYSQL, when it is added
Change the default encoding of MySQL to UTF-8? Just add to the end of the [mysqld] group name in my.ini:
Character-set-server=utf8
That's it. So what is the reason for the error of mysqld:unknown variable 'default-character-set=utf8'? Because the parameter: default-character-set=utf8 has been removed in the newer version of MySQL. Therefore, it is recommended that higher versions of MySQL use "character-set-server" instead of "default-character-set".
Check the character encoding: once set, how can we check whether the character encoding we have set is OK? You can enter at the command prompt:
SHOW VARIABLES LIKE 'char%'
After reading the above, have you mastered how to set the default character encoding in mysql? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.