Grant 新增 MySql 使用者
2009-04-03 14:40
我安裝的版本:
MySQL> select version();
+————+
| version() |
+————+
| 5.0.22-log |
+————+
1 row in set (0.05 sec)
新增使用者:
mysql> grant select,update,insert,delete on *.* to jimmy@AS3 identified by “jimmy”;
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user,password from user;
+———–+——–+——————————————-+
| host | user | password |
+———–+——–+——————————————-+
| localhost | root | |
| AS3 | root | |
| AS3 | | |
| localhost | | |
| AS3 | yuanjl | 550185cd02026208 |
| localhost | yuanjl | 550185cd02026208 |
| AS3 | jimmy | *1E7F320B8F580AADC02E8A70285E46A8CFDA3359 |
+———–+——–+——————————————-+
7 rows in set (0.00 sec)
mysql> quit
Bye
[root@AS3 mysql-5.0.22]# mysql -pjimmy -u jimmy -h AS3 mysql
ERROR 1251: Client does not support authentication protocol requested by server; consider upgrading MySQL client
[root@AS3 mysql-5.0.22]# mysql -u root -h AS3 mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 36 to server version: 5.0.22-log
Type ‘help;’ or ‘/h’ for help. Type ‘/c’ to clear the buffer.
mysql> update user set password=old_password(‘jimmy’) where user=’jimmy’ and host=’AS3′;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
[root@AS3 mysql-5.0.22]# mysql -pjimmy -u jimmy -h AS3 mysql
Welcome to the MySQL monitor. Commands end with ; or /g.
Your MySQL connection id is 37 to server version: 5.0.22-log
Type ‘help;’ or ‘/h’ for help. Type ‘/c’ to clear the buffer.
mysql>
2 、 Mysql 新增使用者
個人教訓,在新增 Mysql 帳號的時候,一定要主義使用者名稱和 WordPress 主機 (local 和%) 均要被引號引起,否則命令即錯
命令方式的. 注意每行後邊都跟個 ; 表示一個命令語句結束.
格式:grant select on 資料庫.* to “使用者名稱”@“登入 WordPress 主機” identified by “密碼”;