Window安装mysql 5.7.19压缩包
https://my.oschina.net/u/2557245/blog/876028
http://www.jianshu.com/p/b601097ef5c9
http://www.phperz.com/article/16/0703/231878.html
http://blog.csdn.net/tanghong1996/article/details/71330666
http://www.bkjia.com/Mysql/1198992.html
http://www.bkjia.com/Mysql/1221297.html
http://www.cnblogs.com/ldybyz/p/7138444.html
http://www.2cto.com/database/201707/660725.html
1 | 1. 解压缩压缩包 |
Window卸载mysql
1 | 以下命令都在cmd中执行,cmd需要以管理员身份运行,即找到cmd程序的路径,然后右键单击选择以管理员身份运行即可,cmd程序的路径为:C:\Windows\System32 |
数据库备份与恢复
http://www.cnblogs.com/zhoujinyi/p/5684903.html
1 | 1. 备份 |
Mysql忘记密码
https://www.skyf.org/reset-mysql579-root-password/
https://my.oschina.net/shf/blog/545684
http://blog.csdn.net/stubbornness1219/article/details/53445904
http://blog.csdn.net/u013378306/article/details/50466073
1 | http://www.cnblogs.com/yuxc/archive/2012/07/25/2607587.html |
Mysql虚拟表
http://yypiao.iteye.com/blog/2359859
http://www.cnblogs.com/jevo/p/3262227.html
http://www.nowamagic.net/librarys/veda/detail/1405
http://2853725.blog.51cto.com/2843725/1394430
临时表
http://blog.sae.sina.com.cn/archives/4096
http://www.runoob.com/mysql/mysql-temporary-tables.html
Mysql慢查询
http://www.jianshu.com/p/7529a0fbf088
https://tech.meituan.com/mysql-index.html
https://www.kancloud.cn/thinkphp/mysql-design-optimalize/39320
https://flyerboy.github.io/2016/12/23/mysql_slow/
http://www.cnblogs.com/ggjucheng/archive/2012/11/11/2765237.html
Mysql排序
http://www.runoob.com/mysql/mysql-order-by.html1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19语法
以下是 SQL SELECT 语句使用 ORDER BY 子句将查询数据排序后再返回数据:
SELECT field1, field2,...fieldN table_name1, table_name2...
ORDER BY field1, [field2...] [ASC [DESC]]
你可以使用任何字段来作为排序的条件,从而返回排序后的查询结果。
你可以设定多个字段来排序。
你可以使用 ASC 或 DESC 关键字来设置查询结果是按升序或降序排列。 默认情况下,它是按升序排列。
你可以添加 WHERE...LIKE 子句来设置条件。
select * from basics_data where pe > 0 and pb > 0 order by pb limit 10;
两个字段升序,默认情况下,它是按升序排列
select * from basics_data where pe > 0 and pb > 0 order by pb, pe limit 10;
一个字段升序,一个字段降序
select * from basics_data where pe > 0 and pb > 0 order by pb, pe desc limit 10;
Mysql更新字段
http://www.runoob.com/mysql/mysql-alter.html1
2
3
4
5
6
7
8
9
10
11
12
13
14更改字段属性not null为null
alter table basics_data modify area varchar(4);
alter table area_data modify area varchar(6);
修改字段属性为not null
alter table basics_data modify area varchar(4) not null default "";
alter table area_data modify area varchar(6) not null default "";
修改默认值
mysql> alter table hist_day_data alter turnover set default 0;
mysql> alter table hist_week_data alter turnover set default 0;
mysql> alter table hist_month_data alter turnover set default 0;
删除数据
http://www.runoob.com/mysql/mysql-delete-query.html1
2
3
4
5mysql> delete from k_week_data where date = '2017-09-21';
Query OK, 2938 rows affected (1.87 sec)
mysql> select * from k_week_data where date = '2017-09-21';
Empty set (10.51 sec)
Mysql索引
http://wiki.jikexueyuan.com/project/mysql/indexes.html
http://www.runoob.com/mysql/mysql-index.html
https://read01.com/78Ojo4.html
http://www.cnblogs.com/hustcat/archive/2009/10/28/1591648.html
https://segmentfault.com/a/1190000003072424
https://tech.meituan.com/mysql-index.html
1 | 数据库查询是数据库的最主要功能之一。我们都希望查询数据的速度能尽可能的快,因此数据库系统的设计者会从查询算法的角度进行优化。最基本的查询算法当然是顺序查找(linear search),这种复杂度为O(n)的算法在数据量很大时显然是糟糕的,好在计算机科学的发展提供了很多更优秀的查找算法,例如二分查找(binary search)、二叉树查找(binary tree search)等。如果稍微分析一下会发现,每种查找算法都只能应用于特定的数据结构之上,例如二分查找要求被检索数据有序,而二叉树查找只能应用于二叉查找树上,但是数据本身的组织结构不可能完全满足各种数据结构(例如,理论上不可能同时将两列都按顺序进行组织),所以,在数据之外,数据库系统还维护着满足特定查找算法的数据结构,这些数据结构以某种方式引用(指向)数据,这样就可以在这些数据结构上实现高级查找算法。这种数据结构,就是索引。 |
MySQL函数
1 | 查询结果求平均值 |
查看警告信息
1 | mysql> show warnings; |