mysql用戶管理
首先要聲明一下:一般情況下,修改MySQL密碼,授權,是需要有mysql里的root權限的。
1.新建用戶
mysql> insert into mysql.user(Host,User,Password) values("localhost","lee",password("1234"));
這樣就創建了一個名為:lee 密碼為:1234 的用戶。
刷新一下系統權限表
mysql>flush privileges;
2.為用戶授權
授權lee用戶擁有test數據庫的所有權限。
grant all privileges on test.* to lee@localhost identified by '1234';
mysql>flush privileges;
3.刪除用戶
mysql>DELETE FROM user WHERE User="phplamp" and Host="localhost";
mysql>flush privileges;
4.修改指定用戶密碼
mysql>update mysql.user set password=password('新密碼') where User="phplamp" and Host="localhost";
mysql>flush privileges;
1.新建用戶
mysql> insert into mysql.user(Host,User,Password) values("localhost","lee",password("1234"));
這樣就創建了一個名為:lee 密碼為:1234 的用戶。
刷新一下系統權限表
mysql>flush privileges;
2.為用戶授權
授權lee用戶擁有test數據庫的所有權限。
grant all privileges on test.* to lee@localhost identified by '1234';
mysql>flush privileges;
3.刪除用戶
mysql>DELETE FROM user WHERE User="phplamp" and Host="localhost";
mysql>flush privileges;
4.修改指定用戶密碼
mysql>update mysql.user set password=password('新密碼') where User="phplamp" and Host="localhost";
mysql>flush privileges;
posted on 2009-12-20 11:28 liyang 閱讀(259) 評論(0) 編輯 收藏 所屬分類: mysql