mysql权限
1.创建用户并且赋予权限:
grant all privileges on *.* to ot@'localhost' identified by "123456" with grant option;
WITH GRANT OPTION 这个选项表示该用户可以将自己拥有的权限授权给别人。
2.刷新权限
flush privileges;
一定要执行这条,权限才能生效
3.查看权限
show grants; show grants for 'jack'@'%';
4.回收权限
revoke delete on *.* from 'ot'@'localhost';
5.重命名账户
rename user 'ot'@'%' to 'ott'@'%';
6.修改密码
SET PASSWORD FOR 'ot'@'localhost' = PASSWORD('123456'); mysqladmin -uroot -p123456 password 1234abcd update mysql.user set PASSWORD = PASSWORD('1234abcd') where user = 'ot'; mysqld_safe --skip-grant-tables & mysql -u root update user set password = PASSWORD('123456') where user = 'root';