一、进入数据库mysql
1.创建本地用户账号:
create user 'clanned'@'localhost' identified by '654321';
localhost 本地网络
2.创建网络用户账号
create user 'clanned'@'%' identified by '654321';
%--网络上任意IP地址
3.刷新授权
flush privileges;
4.为新用户分配数据库权限
grant all privileges on db_name.* to 'user'@'%' identified by '123456';
grant all privileges on db_name.* to 'user'@'localhost' identified by '123456';
%--网络上任意IP地址访问
localhost--本地IP地址访问
5.刷新授权
flush privileges;
6.开启其他用户数据库的数据库操作权限:
查看主机名名:hostname 修改主机名:hostname jcxy
修改主机名配置文件:vi /etc/sysconfig/network
使用root用户开启权限
mysql -u root -p
grant all privileges on `%`.* to 'user'@'localhost' identified by '123456';
授予所有数据库下的所有权限给用户user
刷新授权
flush privileges;
1.创建本地用户账号:
create user 'clanned'@'localhost' identified by '654321';
localhost 本地网络
2.创建网络用户账号
create user 'clanned'@'%' identified by '654321';
%--网络上任意IP地址
3.刷新授权
flush privileges;
4.为新用户分配数据库权限
grant all privileges on db_name.* to 'user'@'%' identified by '123456';
grant all privileges on db_name.* to 'user'@'localhost' identified by '123456';
%--网络上任意IP地址访问
localhost--本地IP地址访问
5.刷新授权
flush privileges;
6.开启其他用户数据库的数据库操作权限:
查看主机名名:hostname 修改主机名:hostname jcxy
修改主机名配置文件:vi /etc/sysconfig/network
使用root用户开启权限
mysql -u root -p
grant all privileges on `%`.* to 'user'@'localhost' identified by '123456';
授予所有数据库下的所有权限给用户user
刷新授权
flush privileges;
7.创建新用户并为其设置密码123,同时授予权限select和update
grant select,update on db_school.tb_student to 'wanming'@'localhost'
identified by '123';
8.授予用户clanned在数据库zz所有表上每小时只能处理一条语句
grant all privileges on zz.* to 'clanned'@'localhost'
with max_queries_per_hour 1;
9.撤回用户对数据库mdzz的所有权限
revoke all on mdzz.* from 'clanned'@'localhhost';