杂项

CREATE DATABASE IF NOT EXISTS yourdbname DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP, ALTER ON ELEPayServer.* TO usereleusr@'%' Identified by 'passwd'; 增加权限

REVOKE SELECT, INSERT, UPDATE, DELETE, CREATE, DROP,ALTER ON `ELEPayServer`.* FROM 'usereleusr'@'%'; 去掉权限

SELECT DISTINCT CONCAT('User: ''',user,'''@''',host,''';') AS query FROM mysql.user;  查看所有用户

show grants for user@'ip' 查看某个用户赋予的权限

REVOKE 权限 ON *.* FROM 'user'@'%';查到什么权限删什么权限

select host,user from mysql.user; 查看mysql 用户权限

Delete FROM user Where User='root' and host='ip'; 删除用户

update mysql.user set Host='%' where HOST='localhost' and User='root';  mysql5.7 允许root远程访问
update user set authentication_string=password('123456') where user='app' and Host='localhost';  更新密码
 
flush privileges;

  

  

原文地址:https://www.cnblogs.com/Tempted/p/8289283.html