3 a- A7 k- H* J: W $ g4 d; i. g0 M/ h+ G& \8 J0 r$ w( R8 Q+ m7 C6 v& z1 {, g2 }
【實例:】 ; ~0 m4 F' d9 O9 J. k 2 H/ y( m f! l b6 m' _5 z$ y. E8 g* x' m& a, n
[root@localhost ~]# mysql -u root -p4 @' o u) ]# \- q0 {
Enter password: ! @5 s7 \$ I$ k4 E8 ]; iWelcome to the MySQL monitor. Commands end with ; or \g. ; ]2 ]- D( a& ~Your MySQL connection id is 23 S. c" y# _. G
Server version: 5.1.52 Source distribution# ~+ y" H" u$ x( F c [% k' F# k, x
Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. % m7 q7 K( s/ }) UThis software comes with ABSOLUTELY NO WARRANTY. This is free software,/ M0 _- c5 ~5 _
and you are welcome to modify and redistribute it under the GPL v2 license/ y- a+ G! B( H' e' [+ Q
5 \7 X/ b" N9 R1 ^. u4 Q
3 I0 V$ k, t/ m9 L7 W9 C5 ^8 {5 iType 'help;' or '\h' for help. Type '\c' to clear the current input statement.9 a& Q" y0 Y% a5 U8 {
8 s# i/ g) N h/ i0 X/ @0 |
9 `+ j7 {9 b/ x, k) g" p/ V
mysql> grant all privileges on *.* to test@localhost identified by '1234567'; //第一個星號是database,第二個星號是table ; P& E/ [4 w4 h0 w- j3 |% e# Y & K1 t5 x& E" n4 d( Y/ r9 m3 M! C% m+ [7 X N3 D! e0 ?
Query OK, 0 rows affected (0.00 sec) //建立test帳號本機權限 , P' U1 |% B4 G( I$ e ( z5 {% _8 I9 {- D: S+ J/ O3 A* b. _4 P* s1 t/ q, ~+ _
mysql> grant all privileges on *.* to test@192.168.1.2 identified by '1234567';) g3 X4 J4 ^5 C! `
9 V6 F1 e( n" o5 d& T7 ^6 ~) |8 ~