砍敺 IT_man 2014-12-31 09:25 蝺刻摩
) A; q" z2 J+ Z: I
9 g2 y1 [) ]/ d% U1 K0 l隤芣/ T- b5 b( x( M' H( h" M* R4 h% \
MySQL鞈摨急甈祆蝡荔靘憒嚗銝撣唾蝬摰蝯奸ocalhost閰梧閰脣董芾賢決ySQL鞈摨急祆雿輻剁閬曄策蝡臭蜓璈蝺衽ySQL鞈摨思蜓璈閰梧撠勗撠撣唾蝬摰蝯阡蝡臭蜓璈雿輻剁銝嫣蝝寞孵賣舀甈芷斗甈嚗MySQL甈敺憭臭誑銝:# H% V# \' S* O d
9 a9 H! t1 {+ R4 h5 e/ j, u# n1 x( n0 ^; Y( b7 @/ N
. b1 t- ~$ U, R鞈摨(DateBase)鈭蝔格:
* {& \; O- r4 P9 _, [0 d+ x3 ^( B% f( ~) e1 K2 f6 ~
( l3 e/ {2 ^0 T8 j/ _" ~ALL PRIVILEGESALTERCREATEDELETEDROPFILEINDEXINSERTPROCESSREFERENCESRELOADSELECTSHUTDOWNUPDATEUSAGE
. c# C/ y2 q" c5 d E1 N9 \% Q4 a/ ^- I* i: {8 y, p0 L
" H; a" {! M8 H$ g8 n) Z1 R6 j$ E: w
# V2 T! N' Y; D5 }, U0 K/ x. O9 ^2 Y鞈銵(Table)怎車甈:
# m4 m+ b" X6 X( r2 G6 N0 ^! w+ N7 `3 q' i( e
7 I! F$ R. Z' hSELECTINSERTUPDATEDELETECREATEDROPINDEXALTER
* O U a- A+ |1 F4 e( g
0 D; U j8 {2 E
% R# A( I7 _ n
4 C6 ], a8 b: ~* v' M& H" P3 S9 M6 n! p; g" M
鞈甈(column)銝蝔格:
* e) n" B* |3 ]$ T" N
/ ^2 U1 ], E8 Q a+ h( l8 j# G7 c4 y( a! F& R. t( r/ T
SELECT INSERT UPDATE
2 R/ a$ V5 `; }' Y7 W+ S) f5 K! |8 z* ]: P5 _
$ }2 i3 f9 Z2 ^* G
$ L; Y5 D; k: w. e7 z6 I
撖虫:2 x9 ~2 d6 x( Z {
: n4 q ~' a$ D1 }
& z7 M! R' o. s; C: O* v5 [[root@localhost ~]# mysql -u root -p+ F6 K7 e7 N/ t {' ~
Enter password:+ L5 g* c& X% D5 v2 p9 R- a) p+ M
Welcome to the MySQL monitor. Commands end with ; or \g.
9 L* e8 h) J9 vYour MySQL connection id is 21 }4 V$ V# H8 `# @
Server version: 5.1.52 Source distribution& `9 c3 a7 v: Q% T
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
- i: `/ G7 C, {7 O3 l! u. tThis software comes with ABSOLUTELY NO WARRANTY. This is free software,* i A! G+ ?: ~
and you are welcome to modify and redistribute it under the GPL v2 license
6 X: c' D$ R6 |' v# p( t
+ _2 T& k0 q+ ]2 `( u* n) |; E1 N+ c& a! J
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement./ Q( R& j& J- w) N8 \) o
3 B7 ^1 H- l$ X& b. [( d4 i+ R( W0 S* k, `: w( c- B3 a& ?
mysql> grant all privileges on *.* to test@localhost identified by '1234567'; //蝚砌留atabase嚗蝚砌眩able0 n. M7 s$ Q' t: p: Y6 m/ |
1 o) p7 C5 I: D: ?8 l
$ x% z4 i! [0 A: b, _
Query OK, 0 rows affected (0.00 sec) //撱箇test撣唾祆甈! X9 K# K7 j) }
& p3 c: p# s3 y$ p' L0 Z/ k6 Z. H4 D K# b4 S
mysql> grant all privileges on *.* to [email protected] identified by '1234567';
2 m5 B% Z- v+ A& u! c( b, A: g% F3 u2 n8 V4 q+ H! l6 l3 o/ H
% O6 w3 O- [% _) {1 F( SQuery OK, 0 rows affected (0.01 sec) //撱箇test撣唾蝡舀" N( E9 S3 f; P( v/ V
: i; ]3 z* J1 ^- ?& i. Y ~2 H7 @
5 k- t( m& `2 i3 I1 ?( m! J, \0 w8 e2 U, P
mysql> select host,user from mysql.user; //亥岷MySQL甈撣唾! y- Y2 j/ b! T& u* c# U/ c
: D; R/ I- x8 i
8 J% x" N( {) J8 Y3 _
+-----------------------+-------+
$ j: O% q- p& c4 i" Z# Y1 G# a I| host | user | \ v+ U. f6 r a
+-----------------------+-------+; v0 {, y# f3 z, g( }
| 127.0.0.1 | root |2 r7 \# ?. ?) q0 |( y- J' v
| 192.168.1.2 | test | //撣唾test蝡舀甈
7 j9 @: S9 l a' g6 l| localhost | |
$ V. z8 V% h( h3 C) r* ~+ ]| localhost | test | //撣唾test祆甈
: t7 I4 V% Y4 d2 e" V' o H& n* j| localhost | root |# T1 H R& m9 n3 }/ |
| localhost.localdomain | |
/ I6 }, y& f% {7 e$ G. j \| localhost.localdomain | root |& ^. \* p5 ^+ t% F0 ?9 |5 ~
+-----------------------+-------+$ S K; u( ~6 i( y. B8 c' N, c p( v
7 rows in set (0.00 sec)
8 B0 u0 E& n) q
# y# T* @2 b O! j! m% J; _0 |. e+ c% D+ D I
mysql> quit //aMySQL" t) _3 ]$ B/ O3 ?/ _
Bye
+ ~; A8 i+ v' U+ i! ]. D[root@localhost ~]% L. P& W$ B8 ~/ A
1 U2 n. g0 U1 ~/ v+ U9 f ]( x
p.s 嗡mysql 閬隤瘜隢http://mail.hmes.kh.edu.tw/~jona/redhat/mysqlphp/mysqlsyntax.htm
2 |) f7 n) q: f2 h, {) b# \* ]& s) Z+ o6 p: w# ]
! r! w0 W# g$ j$ X' f |
|