Articles
224
Tags
44
Categories
41
首页
项目
工具箱
归档
标签
分类
关于
Keysqiu的小屋
MySQL插入数据时,自动获取当前时间写入表中
Back to Home
Search
首页
项目
工具箱
归档
标签
分类
关于
MySQL插入数据时,自动获取当前时间写入表中
Created
2025-11-30
|
Updated
2026-08-25
|
MySQL
|
Post Views:
字段的类型为:timestamp,
往下看,默认那里改为 ==CURRENT_TIMESTAMP==
Author:
Keysqiu
Link:
https://keysqiu.github.io/2025/11/30/MySQL/MySQL%E6%8F%92%E5%85%A5%E6%95%B0%E6%8D%AE%E6%97%B6%EF%BC%8C%E8%87%AA%E5%8A%A8%E8%8E%B7%E5%8F%96%E5%BD%93%E5%89%8D%E6%97%B6%E9%97%B4%E5%86%99%E5%85%A5%E8%A1%A8%E4%B8%AD/
Copyright Notice:
All articles on this blog are licensed under
CC BY-NC-SA 4.0
unless otherwise stated.
MySQL
Previous
mysql常用的聚合函数
一、常用的聚合函数(以下都是求以列为单位) count(col) 表示求指定列的总行数 max(col): 表示求指定列的最大值 min(col): 表示求指定列的最小值 sum(col): 表示求指定列的和 avg(col): 表示求指定列的平均值 1、求总行数 – 返回非NULL数据的总行数 select count(height) from students; – 返回总行数,包含null值记录 select count(*) from students; 2、求最大值 – 查询女生的编号最大值 select max(id) from students where gender = 2; 3、求最小值 – 查询未删除的学生最小编号 select min(id) from students where is_delete = 0; 4、求和 – 查询男生的总身高 select sum(height) from students where gender = 1; – 平均身高 select sum(height) / count(*) from students where ...
Next
MySQL 防止被爬走数据
前两天申请了个云服务器,然后去关掉防火墙方便调试,结果没两天MySQL就被黑了 一个库被删,多了一个库 内容如下: All your data is a backed up. You must pay 0.1 BTC to 19sPh8TP3RKHkEG2x9y8y1yXHTChMgrSXU 48 hours for recover it. After 48 hours expiration we will sell all your data on dark markets and the database dump will be dropped from our server! You can buy bitcoin here, [https://localbitcoins.com](https://localbitcoins.com) or [https://buy.moonpay.io/](https://buy.moonpay.io/) After paying write to us in the mail with your DB IP: recmydb+...
Related Articles
2025-11-30
MySQL 防止被爬走数据
前两天申请了个云服务器,然后去关掉防火墙方便调试,结果没两天MySQL就被黑了 一个库被删,多了一个库 内容如下: All your data is a backed up. You must pay 0.1 BTC to 19sPh8TP3RKHkEG2x9y8y1yXHTChMgrSXU 48 hours for recover it. After 48 hours expiration we will sell all your data on dark markets and the database dump will be dropped from our server! You can buy bitcoin here, [https://localbitcoins.com](https://localbitcoins.com) or [https://buy.moonpay.io/](https://buy.moonpay.io/) After paying write to us in the mail with your DB IP: recmydb+...
2025-11-30
数据库中ID从一个很奇怪的数开始
==说明你上一次生成的id就是乱序了== 解决方法: 使用 navicat ,右键表名,选择截断表 截断表:清空数据表中所有数据,然后ID从1开始 清空表:清空数据表中所有数据
2025-11-30
Windows下MySQL数据库安装(详细)
如果是重装数据库的话,直接把MySQL文件夹下的data文件夹删掉,再从4.1往后按流程走即可 (先看我!!!) 一、下载MySQL压缩包 dev.mysql.com/downloads/mysql/5.5.html#downloads 也可以直接用我这个v8.1.0版本 pan.baidu.com/s/1ImE4HX1zCwe5CeiMF1UfJw?pwd=xo08 提取码:xo08 –来自百度网盘超级会员V4的分享 二、配置环境变量 如下图所示 三、配置用户配置 第一步:在D:\MySQL\mysql-8.1.0-winx64目录下创建一个新的文件后缀名为 .ini 的 my.ini空白文件。 第二步:编辑创建好的my.ini文件,用于初始化mysql数据库 主要修改下面第 ==5== 和 ==7== 行的路径即可 tips:路径必须为“\”的形式。 [mysqld] # 设置3306端口 port=3306 # 设置mysql的安装目录 ----------是你的文件路径------------- basedir=D:\\soft...
2025-11-30
MySQL笔记
数据库存储数据的特点 1、将数据放到表中,表再放到库中 2、一个数据库中可以有多个表,每个表都有一个的名字,用来标识自己。表名具有唯一性。 3、表具有一些特性,这些特性定义了数据在表中如何存储,类似java中 “类”的设计。 4、表由列组成,我们也称为字段。所有表都是由一个或多个列组成的,每一列类似java 中的”属性” 5、表中的数据是按行存储的,每一行类似于java中的“对象”。
2025-11-30
配环境
2025-11-30
mysql常用的聚合函数
一、常用的聚合函数(以下都是求以列为单位) count(col) 表示求指定列的总行数 max(col): 表示求指定列的最大值 min(col): 表示求指定列的最小值 sum(col): 表示求指定列的和 avg(col): 表示求指定列的平均值 1、求总行数 – 返回非NULL数据的总行数 select count(height) from students; – 返回总行数,包含null值记录 select count(*) from students; 2、求最大值 – 查询女生的编号最大值 select max(id) from students where gender = 2; 3、求最小值 – 查询未删除的学生最小编号 select min(id) from students where is_delete = 0; 4、求和 – 查询男生的总身高 select sum(height) from students where gender = 1; – 平均身高 select sum(height) / count(*) from students where ...
Comments
Keysqiu
故不积跬步,无以至千里
Articles
224
Tags
44
Categories
41
Follow Me
Announcement
博客由思源笔记自动同步驱动,写作即发布
Recent Posts
版本管理器的理解
2026-07-17
Hyper-V虚拟机实现Ubuntu复制粘贴
2026-06-26
Windows上用RTK给你的AI编程助手节省Token
2026-05-27
CodeGraph使用指南
2026-05-25
GitHub 提交 Pull Request (PR)完整流程指南
2026-05-22
Search
Loading Database