MySQL manual installation method and Chinese solution _ MySQL

Source: Internet
Author: User
Tags mysql manual
It took one day to install MySQL5.0.27icc on DebianEtchLinux and use JDBC to test Chinese! * The key to the PCs2-r + W1 Chinese problem is that all uses UTF-8 encoding, MySQL5 release supports UTF-8, but the default is latin1, Java uses Unicode internally, therefore, to ensure that the JSP page with UTF-8 encoding, JDBC driver using solutions mysql installation

It took one day to successfully install MySQL 5.0.27 icc on Debian Etch Linux and use JDBC to test Chinese! * PC/s>
2-r + W1
The key to the Chinese problem is that all uses UTF-8 encoding, MySQL 5 release supports UTF-8, but the default is latin1, Java uses all Unicode internally, so ensure that the JSP page is encoded in UTF-8, the JDBC driver adopts the official Connector4J 5.0.4, and the Chinese language is normal in the Resin 3.1/Spring 2.0/Hibernate 3.2 environment. S _ '9kz
9: running 6d ~
8 hZ D/
1. Download "mysql-standard-5.0.27-linux-i686-icc-glibc23.tar.gz", recommended ICC version, said to improve performance 10-20%/@ 7d5 ('0g _
P $> B! 2vU
2. copy to/usr/local/, decompress: tar zxvf mysql-standard-5.x....tar.gz $ MCnN} 3D
8jS; av
3. add users and groups mysql: JC! A; RX =
T "r Groupadd mysql> Js] * O-b5
@ QbgV +
Useradd-g mysql +,) 9 ^ YC
* V/B & "'B
4. create a symbolic connection:/usr/local # ln-s mysql-standard-5.x... mysql LQdx1w + Q
A LYGx6
5. cd mysql. change the current directory to/usr/local/mysql/; Uf) HL.
H * 9 w Fe2
6. run the script to initialize the database:./scripts/mysql_install_db -- user = mysql j9T; # n} g
~ X [r$ 83IlC
7. set permissions: 6 6-7
NFS $ zooz7
/Usr/local/mysql # chown-R root. W3tI {7Z
UIG, AO ~ X
/Usr/local/mysql # chown-R mysql data \ cxHVX
1g a2n (X
/Usr/local/mysql # chgrp-R mysql JZH9tBS_W
AY [jZuX 'p
6 = (dW>
-------------------------------------------------------------------------------- KvW> U 2
I5M_Zp
8. create and modify/etc/my. cnf as needed. refer to the configuration: AtZ <B _?
$ FA \ jFY;
[Mysqld] V '2pp'
'Le! B5iVr
# Set the default value to the INNODB table, which supports transactions: 3D30 =,
BVM) 1Is-
Default-storage-engine = INNODB 7 @ jm = wm
7G (Aq!
# Set the default character set UTF-8: W}) % d' 3 & Y
% Ke; Hxs :~
Character-set-server = utf8 Q ^ j6R |
H> Cf0p> 8 (,
Collation-server = utf8_general_ci]: 0iB #~
EI4 = J. N
BftmtlF +
Default-character-set = utf8 ve {9>]
ISipZ [}; @]
# Disable bdb: mk I @
SCF Z
Skip-bdb D6g/ua5 \
> GA-Ghf
9. start MySQL: sY? A> 8,) kT
= JO ~ /Usr/local/mysql/bin #./mysqld_safe -- user = mysql & vY "q *
D] D + bB
10. initialize the root password: BY3 pfow @
/PrHxDOoZ
/Usr/local/mysql/bin #./mysqladmin-u root-p password "password-of-root" xcOX80
"QKSZ
Enter password: <输入旧口令,直接按enter> ?, S, r P7N
? $51 P} |
<{5A Izu @
-------------------------------------------------------------------------------- J * h % o' '{r
11. log on to the root account to create a database: 1P0h \ rO
/Usr/local/mysql #./mysql-u root-p ^ Ia? B2 @
8 [7A! TytK7
Enter password: password-of-root odAU ZAFZv] Tj
12. create a new user: [2 qTm5
RAr 33! U
Mysql> create user test identified by 'test-password'; _ ow {'B:
G? 5, 0D
13. create a new database: \ fuk % \
Je ~ 0 ~ Z
Mysql> create database testdb default character set utf8 default collate utf8_general_ci; 4 | x1l
. Z * 6c 4Z
Be sure to specify the character set and sort method, both UTF-8, to ensure that the created table also uses the UTF-8. M0 <3wB
6. Ahaq
I '9u} t
14. Grant the test user the permission to access testdb from localhost and use the password w: uZ "{J'
-E <43 S> p
Mysql> grant all on testdb. * to test @ localhost identified by 'test-password ';? A6! # Os1
FTL ^ w-
Note: to remotely connect to MySQL using JDBC, you must set the test user permission correctly. the MySQL access permission consists of the user name, client machine name, and password, in the preceding example, only the test user is allowed to connect to MySQL through a password on the local machine (localhost. 9, ba [n |
'Pf9 $
\ V -------------------------------------------------------------------------------- C d5) 8n
0563 \*
15. stop the MySQL server: (9 ~ QYk = h
-JX8 # YB7O
/Usr/local/mysql/bin #./mysqladmin-u root-p shutdown bRHUc] OI
DIIMNv [5
Enter password: password-of-root _ CU} gLt
X9 ,{-~ P
STOPPING server from pid file/usr/local/mysql/data/debian. pid Y/tUz> x \
K = [! 9) 8 TB
Xxx mysqld ended &] G \ & D5
Chinese cheats: All encoding-related settings in/etc/my. cnf should be set to UTF-8, refer to Step 8. ==? Rpt
To debug jTCx, follow these steps: | jTCx [AJ7
T [2) Rt
Mysql> status; Zvz! JA, GL
Note that the characterset values must be UTF-8. otherwise, modify/etc/my. cnf. refer to Step 8. 9 NdoZK :) N
W's3, 1
Mysql> show variables like '% char %'; DhI _ "gk"
Except character_set_filesystem is displayed as binary, all others should be displayed as utf8. if not, modify/etc/my. cnf. refer to Step 8. R5H \ V l \
SUxWSte
Mysql> show variables like '% collation %'; TDg <= OK
The display should all be utf8_general_ci. otherwise, modify/etc/my. cnf. refer to Step 8. 8D3h4gQW3D
; J [q \ 1} h}
Mysqlshow-u root-p-I database-name SYGf @ mQ
Role: show the database details, if you do not see utf8_general_ci, but latin_swedish_ci, indicating that the database code is not UTF-8, Chinese is certainly not normal, delete it, and then refer to Step 13 to re-create a database with a UTF-8.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.