1、查看mysql所有用户及权限
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
2、查看数据库中具体某个用户的权限
show grants for 'root'@'%';
3、刷新权限
flush privileges;
4、创建用户
create user 'datauser'@'10.10.11.%' identified by 'db-password';
5、显示当前用户
select user();
6、权限
grant all privileges on *.* to 'user'@'%' identified by 'password' with grant option;
grant all privileges on database.table to 'user'@'%' identified by 'password' with grant option;
7、修改密码:
mysqladmin -u root -p 123 password 456 (使用mysqladmin语法:mysqladmin -u用户名 -p旧密码 password 新密码)
set password for root@localhost=password('');
8、删除用户和撤销权限
drop user username@'%'
delete from user where user='sss' and host='localhost';
SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;
2、查看数据库中具体某个用户的权限
show grants for 'root'@'%';
3、刷新权限
flush privileges;
4、创建用户
create user 'datauser'@'10.10.11.%' identified by 'db-password';
5、显示当前用户
select user();
6、权限
grant all privileges on *.* to 'user'@'%' identified by 'password' with grant option;
grant all privileges on database.table to 'user'@'%' identified by 'password' with grant option;
7、修改密码:
mysqladmin -u root -p 123 password 456 (使用mysqladmin语法:mysqladmin -u用户名 -p旧密码 password 新密码)
set password for root@localhost=password('');
8、删除用户和撤销权限
drop user username@'%'
delete from user where user='sss' and host='localhost';