mysql使用表user,来存储所有用户的操作权限,该表在mysql数据库中。
添加和修改用户的权限,可以通过grant命令来完成,例如
grant privilege (all privileges) on table (*.*) to root@ipaddr(%)identified by passwd with grant option
也可以直接修改表就可以,例如:
mysql> INSERT INTO user VALUES('localhost','monty',PASSWORD('something'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql> INSERT INTO user VALUES('%','monty',PASSWORD('something'),
'Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y')
mysql> INSERT INTO user SET Host='localhost',User='admin',
Reload_priv='Y', Process_priv='Y';
mysql> INSERT INTO user (Host,User,Password)
VALUES('localhost','dummy','');
改完之后,记得要FLUSH PRIVILEGES,这样就ok了
mysql其它有用命令:
show processlist 查看当前的所有连接
kill xxx 杀死某个连接