随笔分类 - mysql
mysql相关知识
摘要:mysql数据库服务双主搭建 1、搭建两台数据库服务环境,master,slave 数据库搭建参考:https://www.cnblogs.com/zuouncle/p/17713806.html 2、查看服务运行状态 systemctl status mysqld 3、主库1(master)配置
阅读全文
摘要:mysql数据库服务主从搭建 1、搭建两台数据库服务环境,master,slave 数据库搭建参考:https://www.cnblogs.com/zuouncle/p/17713806.html 2、查看服务运行状态 systemctl status mysqld 如果显示以下内容就关闭mysql
阅读全文
摘要:centos7使用mysql压缩包安装mysql5.7 1、安装相关的命令环境 安装vim命令 yum -y install vim* 安装netstat命令 yum -y install net-tools 2、上传mysql压缩包到/usr/local/并解压重名 下载地址:https://do
阅读全文
摘要:导出数据库表格为excel格式: SELECT COLUMN_NAME 列名, DATA_TYPE 字段类型, ifnull(ifnull(CHARACTER_MAXIMUM_LENGTH, NUMERIC_PRECISION), DATETIME_PRECISION) 长度, ifnull(NUM
阅读全文
摘要:mysql结合binlog实现数据误删误改后的数据恢复 测试数据: 建表 CREATE TABLE `student` ( `id` int NOT NULL AUTO_INCREMENT, `name` varchar(255) COLLATE utf8mb4_general_ci DEFAULT
阅读全文
摘要:mysql字符串分割 1、字符串分割函数 drop function if exists str_for_substr; CREATE DEFINER = `root`@`%` FUNCTION `str_for_substr`(`num` int, `str` varchar(5000)) RET
阅读全文
摘要:监控库中存储和函数变更记录存储 1、建表 create table etl_log select now() etl_time, routine_type object_type, specific_name object_name, routine_schema schema_name, coun
阅读全文
摘要:查看用户在某天刷题后第二天还会再来刷题的平均概率 1、数据准备 CREATE TABLE `question_practice_detail` ( `id` int NOT NULL, `device_id` int NOT NULL, `question_id`int NOT NULL, `res
阅读全文
摘要:mysql计算正态分布、差异系数、离均差、离均差率 1、数据准备 建表 drop table if exists score; create table score( id int not null primary key auto_increment, score decimal(10,2) no
阅读全文
摘要:mysql游标的使用 1、数据准备 建表 # 建表 drop table if exists store; CREATE TABLE IF NOT EXISTS `store` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(20) NO
阅读全文
摘要:mysql中位数计算方式 1、建表 drop table test_cunchu.score; create table test_cunchu.score( id int not null primary key auto_increment, score decimal(10,2) not nu
阅读全文
摘要:获取随机中文名函数 函数如下: 1 create function rand_name() returns varchar(128) 2 begin 3 # 随机生成姓名函数 4 # 初始化十六姓氏的字符串,作为姓氏库 5 declare family_str varchar(128) defaul
阅读全文
摘要:获取随机字符串函数 函数如下: drop function if exists rand_string; create function rand_string(num int) returns varchar(255) no sql begin -- 随机字符串函数 # 定义字符串默认值(26个小
阅读全文
摘要:mysql间隔15分钟统计数量 创建表: TRUNCATE table LX_02; 添加数据: insert into LX_02 values(1,'2020-1-14 09:07:23'); insert into LX_02 values(8,'2020-1-14 09:53:23'); i
阅读全文