In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to make MYSQL fully support Chinese". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to make MYSQL fully support Chinese"!
First let slack support Chinese, the method can see "linuxsir.org Slackware discussion area", and then recompile mysql, the original system mysql should be uninstalled first.
Login:root
Shell > removepkgmysql
Shell > groupaddmysql
Shell > cd/app
Shell > mkdirmysql
Shell > chmod744mysql
Shell > useradd-Gmysql-s/bin/bash-p/app/mysqlmysql
Shell > chown-Rmysql.mysqlmysql
Download mysql4.x.x
Shell > gunzip
Shell > cdmysql-VERSION
Shell > CFLAGS= "- O3-mcpu=pentium3"\
CXX=gcc\
XXFLAGS= "- O3-mcpu=pentium3-felide-constructors"\
. / configure--prefix=/app/mysql\
-- with--charset=gbk\
-with-extra-charsets= "gbkgb2312big5utf8"\
-- with-unix-socket-path=/etc/mysql.sock\
-- enable-local-infile\
-- enable-thread-safe-client\
-- enable-assembler\
-- with-client-ldflags=-all-static\
-- with-mysqld-ldflags=-all-static
/ /-mcpu compiles optimally according to the CPU type, which can make your mysq perform better! There are many items to choose from: i386 and 486, i486, i586, and i686, pentium.pentiumMmx.pentium2, pentium3, pentium4, pentium4, pentium3, pentium4, pentium4, pentium3, pentium4, pentium3, penti
Shell > make
--
At the wrong time
Shell > makeclean
Go back to the previous step
Shell > makeinstall
Shell > cpsupport-files/my-medium.cnf/etc/my.cnf
Shell > cd/app/mysql
Shell > bin/mysql_install_db--user=root
Shell > chown-Rroot.
Shell > chown-Rmysqlvar
Shell > chgrp-Rmysql.
Shell >. / bin/mysqld_safe--user=root--default-character-set=gbk&
Shell >. / bin/mysqladmin-urootpassword'new-password'
Shell >. / bin/mysql-uroot--default-character-set=gbk-p
Mysql > status
...
Servercharacterset:gbk
Dbcharacterset:gbk
Clientcharacterset:gbk
Conn.characterset:gbk
....
It is a success to see that characterset is all gbk.
How to make MYSQL fully support Chinese
In the old database of the UTF8 character set, create the text of the Chinese support table as follows, and add the character set description to the field.
CREATETABLE`test`.`cn` (
`zh`Char (10) CHARACTERSETgb2312COLLATEgb2312_chinese_ciNOTNULL
`Chinese `INT (11) NOTNULL
)
ENGINE=MYISAM
Note: CHARACTERSET can write both GB2312 and gbk, and gbk is better than gb2312.
Add a default character set declaration GBK to the newly created database, so you don't have to declare every field when you build the table, so it looks simple and smooth, and there is no special trace. It is recommended to use this method.
Mysql > CREATEDATABASEdbCNDEFAULTCHARACTERSETgbkCOLLATEgbk_chinese_ci
CREATETABLE`dbCN`.`cn` (
`zh`Char (10) NOTNULL
`Chinese `INT (11) NOTNULL
)
ENGINE=MYISAM
Mysql > insertintocnvalues (really?, 1)
Note: if these scripts cannot be entered with the bin/mysql command line, you can use mysqlqueryBrowser or execute them programmatically.
Shell > bin/mysql-uroot--default-character-set=gbk-p
Mysql > usetest
Mysql > select*fromcn
+-+ +
| | zh | Chinese |
+-+ +
| really? | 1 |
+-+ +
1rowinset (0.00sec)
-
Finally modify the startup file / etc/rc.d/rc.mysqld
Change the route / app/mysql/bin/mysqld_safe
Change the route / app/mysql/var/web.pid
Add-- user=root--default-character-set=gbk after / app/mysql/bin/mysqld_safe
At this point, I believe you have a deeper understanding of "how to make MYSQL fully support Chinese". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.