. j: _- R# `% h+ Z ! R5 r4 H- y* \7 r& f 8 m4 O' r$ w0 k! i+ t【實例:】 f1 P2 ^: e2 O4 U3 ~0 K1 V ; ^( a$ ?+ B# |) s+ y2 a8 B- i9 b& _
[root@localhost ~]# mysql -u root -p+ C& K I' w% b0 a, C5 @0 G
Enter password: / R7 p3 A1 I8 M8 f: qWelcome to the MySQL monitor. Commands end with ; or \g. U! W3 _* O7 v. h# n# Q* C1 C/ }9 iYour MySQL connection id is 23 g5 R& `- M( ]; z3 |9 l! R
Server version: 5.1.52 Source distribution 5 S& k) T& j$ [/ v& bCopyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. t, Y0 d8 C) `( [3 d F3 dThis software comes with ABSOLUTELY NO WARRANTY. This is free software, 5 ^4 y$ ~$ T( S/ C3 Kand you are welcome to modify and redistribute it under the GPL v2 license* ^9 J6 ~% o" u$ W1 M5 G
# E! w, E m3 Z, Q/ U7 v1 [) c0 j! j; Z( b6 z/ A% b* I
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 9 d4 b! d: ~1 O4 k8 G& U6 k2 a- A3 T5 h z6 e5 z, M: z6 j
% Q1 U7 S# \6 M
mysql> grant all privileges on *.* to test@localhost identified by '1234567'; //第一個星號是database,第二個星號是table& f0 l, S9 y% Z0 e7 Z1 Q
. b/ r. X5 }, j6 h4 i3 ]8 R* k- s/ D
Query OK, 0 rows affected (0.00 sec) //建立test帳號本機權限 / f) X6 x# z; E! m ^- H* H: Z) D& B1 Z2 L) }+ p
: s ~' d0 G* y' _; s
mysql> grant all privileges on *.* to test@192.168.1.2 identified by '1234567'; + W0 H6 X5 u9 Q" x9 L% F( H: w& U3 I+ _5 n4 C7 q( i! C- n