MYSQL 简单操作
1、grant语句
格式:grant select on 数据库.* to 用户名@登录主机 identified by “密码”
说明:
(1)grant all 赋予所有的权限
(2)demo.* 数据库 demo 中所有的表
(3)newuser 用户名
(4)@localhost 在本地电脑上的 mysql server 服务器
(5)identfified by ‘password’ 设置密码
设置root 用户 及密码root :GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
增加一个用户test1密码为abc,让他可以在任何主机上登录,并对所有数据库有查询、插入、修改、删除的权限。首先用以root用户连入MYSQL,然后键入以下命令:
grant select,insert,update,delete on *.* to test1@“%” Identified by “abc”;
mysql>GRANT ALL PRIVILEGES ON *.* TO monty@localhost IDENTIFIED BY ‘password’ WITH GRANT OPTION;
mysql>GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP ON *.* TO custom@192.168.206.% IDENTIFIED BY ‘password’;
==============
mysql>INSERT INTO user (host,user,password) VALUES(’192.168.206.%’,'high_vod’,PASSWORD(‘high_vod’));
mysql>INSERT INTO db VALUES(’192.168.206.%’,'high_vod’,'high_vod’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'N’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’,'Y’);
mysql>FLUSH PRIVILEGES;
==============
删除用户
use mysql
mysql>Delete FROM user Where User="xxxxx" and Host="localhost";
mysql>flush privileges;