In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following mainly brings you to modify the MySQL character set garbled and library character set method, hope to modify the MySQL character set garbled and library character set method can bring you practical use, this is also my main purpose of editing this article. All right, don't talk too much nonsense, let's just read the following.
Unified character set ensures no garbled code: utf8 is recommended for both Chinese and English environments.
1.linux system language
/ etc/sysconfig/i18n
LANG= "zh_CN.utf8"
2.mysql client
Temporary:
Set names utf8
Permanent:
Profile my.cnf
[client]
Default-charater-set=utf8
3.mysql server
[mysqld]
Character-set-server=utf8
4.mysql database building table statement
Specified character set to build a database
Create database oldboy_utf8 default character set uft8 collate utf8_general_ci
Specified character set creation table
Create table student (
Id int (4) not null auto_increment
Name char (20) not null
Primary key (id)
) engine=inonodb auto_increment=10 default charset=utf8
5. The character set of the development program
Simulate the actual process of modifying the database of latin1 character set to GBK character set
1. Export table structure
Mysqldump-uroot-p-- default-character-set=latin1-d dbname > alltatale.sql
-- default-character-set=latin1 connects with latin1-d only table structure
two。 Edit alltable.sql to change latin1 to gbk
Sed replacement
3. Make sure the database is not being updated and export all data
Mysqldump-uroot-p-quick-no-create-info-extended-insert-default-character-set=latin1 dbname > alldata.sql
4. Open alldata.sql to modify set names latin1 to set names gbk; (or modify the server and client of the system)
5. Build a database
Create database dbname default charset bgk
6. Create tables and execute alltable.sql
Mysql-uroot-p dbname
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.