mysql5.7 用户和schema

prompt = "\\u@\\h [\\d]"

用户名的长度:建议8-16字符之间

show privileges;

help create user;

select user(),current_user();

5.6 select substring_index(host,":",1) count(*) as conn from processlist group by substring_index(host,":",1); #过滤出host,: 为分割符号。

5.7 select host,current_connections from host_summary;

authentication_string  #MySQL加密字段

删除用户后kill 连接后,无法连接。

drop user "zhangshuo"@"192.168.1.1";==delete from  mysql.user where user='zhangshuo' and host ='192.168.1.1';

flush privileges;# 让数据库重新读取user表,重新加载到内存。

 

====================

mysql密码忘记怎么办?

[mysqld]

skip-grant-tables

update xxx;

 

mysql --defaults-file=/path/my.cnf --skip-grant-tables &

update xxx;

8.0之前:

拷贝user.frm,user.MYD,user.MYI  拷贝到其他实例修改好后再拷贝回来:

update user set authentication_string=password('zhangshuo') where user ='root' and host='localhost';

kill -HUP pid  

flush tables; #遇到操作大表刷不动,所有表关闭重新打开,当有操作不可能关闭。

flush logs; #遇到大事物刷不动,产生新的binlog。

 

posted on 2017-03-28 20:10  zhangshuo  阅读(1489)  评论(0编辑  收藏  举报

导航