" ]8 l' Q! K4 N: j , _6 m7 S( \2 E9 f. ^* M$ l- D0 J[root@localhost ~]# mysql -u root -p* d- M- g& F8 J5 }
Enter password: & Z% ]# R/ z1 ]* w& W' }( {) sWelcome to the MySQL monitor. Commands end with ; or \g. ^- V- [7 J4 FYour MySQL connection id is 2- P* ?! V/ n ^: M# p( u" x
Server version: 5.1.52 Source distribution 7 g: ^* z/ N7 |5 W5 Z5 J3 Z8 v& N# fCopyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.; P4 C3 K# w6 M/ g* ~4 l2 I% l
This software comes with ABSOLUTELY NO WARRANTY. This is free software,$ Y6 L( X0 v# t% M: `" {
and you are welcome to modify and redistribute it under the GPL v2 license ( n% m1 h2 f- _3 F! o! Q6 U z: D4 v. w+ v: i7 m \1 V0 c+ Z
1 T2 b0 a9 A( O
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.! Y: n3 Z6 v* ^
, j5 R: s6 o- X; i' Q% K# R6 [& ^1 C5 B$ B9 G. ?2 V5 h4 x
mysql> grant all privileges on *.* to test@localhost identified by '1234567'; //第一個星號是database,第二個星號是table + F5 D( T4 Q$ S- {/ S1 I' _# r) \ 1 V1 ~, k2 \/ k. M& S2 i8 W' ]& t5 G! L4 z# ?+ n3 {* w
Query OK, 0 rows affected (0.00 sec) //建立test帳號本機權限+ s9 Q, ^5 a( s8 S# y1 t
$ }% C8 p! {: i1 D4 V
$ k3 }9 c$ p$ u- h" ]4 L, m
mysql> grant all privileges on *.* to [email protected] identified by '1234567'; & o4 y5 X9 _6 V1 w0 d7 o2 [3 u# g. r/ O( b) P5 J
3 r4 g* w) h4 A' Q/ e4 n( r/ ?, m
Query OK, 0 rows affected (0.01 sec) //建立test帳號遠端權限 3 Z9 a: g: c9 W; a+ C 7 a& H" ?, R9 X% u% {; n9 W7 ^2 ^( v: \- Z5 h1 ~
# l' {$ v; r6 A: o) G+ o4 ]+ rmysql> select host,user from mysql.user; //查詢MySQL所有授權帳號 ; |9 _" d# l! J& f J: k% o! y2 @" f2 I0 x5 I