6、移除权限 REVOKE <privileges> ON <database>.<table> FROM'用户名'@'ip地址';
demo: CREATE DATABASE afei_db; CREATE USER 'afei'@'%' IDENTIFIED BY'123456'; SELECT host, user, password FROM mysql.user WHERE user='afei'; grant all privileges on afei_db.* to'afei'@'%'; #没有指定密码授权 SHOW GRANTS FOR'afei'@'%'; flush privileges; #刷新
扩展命令 grant all privileges on afei.* to afei@l% identified by'123456'; #指定命令授权 drop user 'afei'@'%'; #删除用户
linux 查看 MySQL 版本
1、在help中查找 mysql –help |grep Distrib 2、在help中查找 mysql –help |grep Distrib
Mysql 常用性能分析方法??
1 2 3 4 5 6
select version(); #查版本号 show processlist; #查看那些线程正在运行 show profiles; show profiles for query 3; #更具query_id 查看某个查询的详细时间耗费 explian + sql # 分析执行计划和最左前缀原理 reset query cache; #清除缓存
mysql SQL 执行顺序
1 2 3 4 5 6 7 8 9 10
(7) SELECT (8) DISTINCT <select_list> (1) FROM <left_table> (3) <join_type> JOIN <right_table> (2) ON <join_condition> (4) WHERE <where_condition> (5) GROUPBY <group_by_list> (6) HAVING <having_condition> (9) ORDERBY <order_by_condition> (10) LIMIT <limit_number>