mysql常用sql

运维常用查询语句

#查看mysql的运行时长
show global status like 'uptime'; 
#查看数据库所有连接概况
show full processlist; 
#查看总最大连接数
show variables like '%max_connections%'; 
#查看单个用户最大连接数,设置为0表示不限制
show variables like '%max_user_connections%';
#根据用户查看当前连接数
select USER , count(*) from information_schema.processlist group by USER; 
#根据ip查看当前连接数
select SUBSTRING_INDEX(host,':',1) as ip , count(*) from information_schema.processlist group by ip; 
#查看连接时间最长的连接信息
select host,user,time,state,info from information_schema.processlist order by time desc limit 10;

增删改查

#改内容
update cinder.volumes set id=’XXX’where name=’XXXX’; 
#删内容 
delete from 表名 where 条件
#插入内容
insert into joke (gid,name)value(0,"joker");
原文地址:https://www.cnblogs.com/jinyuanliu/p/11382789.html