--检查在线用户的重复ip select ip from web_session group by ip having count(*)>1; --检查订单表是否有错误的重复记录 select a.id,b.username,a.no,a.color,a.bx from web_order a,web_client b where a.uid=b.id group by a.uid,a.iid,a.color,a.bx having count(*)>1 --新增一个用户 grant all privileges on *.* to hehe@localhost identified by "hehe" WITH GRANT OPTION; --授权远程连接 grant all privileges on *.* to hehe@'%' identified by "hehe"; --修改表的字段 alter table web_zk modify zk decimal(5,2) unsigned not null default '0.00'; --创建索引 create index ind_upath on web_order (upath); --输出查询结果到文本文件 select * from web_order into outfile 'c:/1.txt'; --备份数据库 mysqldump -hlocalhost -uhehe --default-character-set=latin1 -p edt > d:\edt.sql --恢复数据库 mysql -hlocalhost -uhehe -p edt_ybd < D:\web\edt\cli\hz\ibd\mysql_ibd_2018x_20171107185606.sql --慢查询日志 show variables like '%quer%'; slow_query_log的值为ON为开启慢查询日志,OFF则为关闭慢查询日志。 long_query_time 指定了慢查询的阈值,即如果执行语句的时间超过该阈值则为慢查询语句,默认值为10秒。 set global slow_query_log=on; 开启慢查询日志 show global status like '%slow%'; 显示慢查询状态