mysql进阶学习
2016-03-30 11:49
507 查看
1,sql小例子
SELECT c.coupon_name,c.coupon_id,c.coupon_value,c.camp_condition,c.issue_amount,c.remain_amount,s.store_name,
c.local_coupon_condition,from_unixtime(c.start_time,'%Y-%m-%d %H:%i:%s') as starttime,
c.local_coupon_condition,from_unixtime(c.end_time,'%Y-%m-%d %H:%i:%s') as endtime
FROM aumall.br_coupon as c left join br_store as s on c.store_id = s.store_id left join br_region r on s.region_id = r.region_id
where s.region_id = 36883;
关于慢查询:将超过指定时间的查询语句
show variables like '%long%';
long_query_time 慢查询的一个时间
show status like 'com_Select'; //查看链接语句
show status like 'connections'; //查看链接有几条
set long_query_time = 1; //设置慢查询的查询时间
启动慢查询步骤:
net stop mysql ; //关闭mysql服务
mysqld.exe --safe--mode --slow--query--log //以安全模式启动慢查询
在mysql下面有一个my.ini: datadir=E:/wamp/bin/mysql/mysql5.5.24/data 这个就是慢查询的日志记录
这个文件夹下面 slow.log 就是记录的条数
学习视频:
http://www.maiziedu.com/course/335/
SELECT c.coupon_name,c.coupon_id,c.coupon_value,c.camp_condition,c.issue_amount,c.remain_amount,s.store_name,
c.local_coupon_condition,from_unixtime(c.start_time,'%Y-%m-%d %H:%i:%s') as starttime,
c.local_coupon_condition,from_unixtime(c.end_time,'%Y-%m-%d %H:%i:%s') as endtime
FROM aumall.br_coupon as c left join br_store as s on c.store_id = s.store_id left join br_region r on s.region_id = r.region_id
where s.region_id = 36883;
关于慢查询:将超过指定时间的查询语句
show variables like '%long%';
long_query_time 慢查询的一个时间
show status like 'com_Select'; //查看链接语句
show status like 'connections'; //查看链接有几条
set long_query_time = 1; //设置慢查询的查询时间
启动慢查询步骤:
net stop mysql ; //关闭mysql服务
mysqld.exe --safe--mode --slow--query--log //以安全模式启动慢查询
在mysql下面有一个my.ini: datadir=E:/wamp/bin/mysql/mysql5.5.24/data 这个就是慢查询的日志记录
这个文件夹下面 slow.log 就是记录的条数
学习视频:
http://www.maiziedu.com/course/335/
相关文章推荐
- MySQL 添加列,修改列,删除列
- MySQL 常用的命令
- mysql 表迁移
- LNMP环境搭建——MySQL篇
- mysql 使用命令行连接数据过程
- mysql 5.6忘记root密码之后如何重新设置密码
- Mysql binlog 安全删除
- W7x64下Mysql5.7.11配置
- Mysql 源码编译安装 ( 5.5 、5.6 共存 )
- ubuntu server 12.04 安装 mysql5.7
- mysql in 的两种使用方法
- 为mysql添加远程访问权限
- MySQL 二进制读写语句
- mysql 去除重复 Select中DISTINCT关键字的用法
- MySQL性能优化的最佳20+条经验
- ubuntu中fatal error: mysql.h: No such file or directory
- Mysql用户设置密码和权限
- mysql-函数if多值多结果判断
- 配置Mysql时候遇到一些坑
- MySQL validate_password 插件