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 shows you "how to make MYSQL fully support Chinese". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and learn this article "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 > removepkg mysql
Shell > groupadd mysql
Shell > cd / app
Shell > mkdir mysql
Shell > chmod 744 mysql
Shell > useradd-G mysql-s / bin/bash-p / app/mysql mysql
Shell > chown-R mysql.mysql mysql
Download mysql4.x.x
Shell > gunzip
< mysql-VERSION.tar.gz | tar -xvf - shell>Cd mysql-VERSION
Shell > CFLAGS= "- O3-mcpu=pentium3"
CXX=gcc
XXFLAGS= "- O3-mcpu=pentium3-felide-constructors"
. / configure-- prefix=/app/mysql
-- with--charset=gbk
-with-extra-charsets= "gbk gb2312 big5 utf8"
-- 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 optional items: i386, i486, i586, i686, pentium, pentium-mmx, pentiumpro, pentium2, pentium3, pentium4, K6, K6-2, K6-3, athlon, athlon-tbird, athlon-4, athlon-xp,athlon-mp,winchip-c6, winchip2, c3.
Shell > make
--
At the wrong time
Shell > make clean
Go back to the previous step
Shell > make install
Shell > cp support-files/my-medium.cnf / etc/my.cnf
Shell > cd / app/mysql
Shell > bin/mysql_install_db-- user=root
Shell > chown-R root.
Shell > chown-R mysql var
Shell > chgrp-R mysql.
Shell >. / bin/mysqld_safe-user=root-default-character-set=gbk &
Shell >. / bin/mysqladmin-u root password' new-password'
Shell >. / bin/mysql-u root-- default-character-set=gbk-p
Mysql > status
...
Server characterset: gbk
Db characterset: gbk
Client characterset: gbk
Conn. Characterset: gbk
....
It is a success to see that characterset is all gbk.
-
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.
CREATE TABLE `test`.`cn` (
`zh` CHAR (10) CHARACTER SET gb2312 COLLATE gb2312_chinese_ci NOT NULL
`Chinese `INT (11) NOT NULL
)
ENGINE = MYISAM
Note: CHARACTER SET 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 > CREATE DATABASE dbCN DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci
CREATE TABLE `dbCN`.`cn` (
`zh` CHAR (10) NOT NULL
`Chinese `INT (11) NOT NULL
)
ENGINE = MYISAM
Mysql > insert into cn values ("really?" , 1)
Note: if these scripts cannot be entered with the bin/mysql command line, you can use mysql query Browser or execute them programmatically.
-
Shell > bin/mysql-u root-- default-character-set=gbk-p
Mysql > use test
Mysql > select * from cn
+-+ +
| | zh | Chinese |
+-+ +
| really? | | 1 |
+-+ +
1 row in set (0.00 sec)
-
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
The above is all the contents of the article "how to make MYSQL fully support Chinese". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.