随笔分类 -  MySQL

摘要:# Disabling symbolic-links is recommended to prevent assorted security risks #symbolic-links=0 # Settings user and group are ignored when systemd is u 阅读全文
posted @ 2023-11-22 10:34 翠微 编辑
摘要:<select id="checkTableExists" resultType="java.util.Map"> select count(*) as cnt from information_schema.tables where table_schema = database() and `t 阅读全文
posted @ 2023-03-10 16:28 翠微 编辑
摘要:MySQL 8.0.19及更新版本,支持连续几次输入错误密码,锁定账户功能 FAILED_LOGIN_ATTEMPTS:代表尝试失败的次数 PASSWORD_LOCK_TIME:代表锁定的时间,单位天。 #指定策略和加密插件,连续输错2次后,锁定一天 CREATE USER `test`@`%` I 阅读全文
posted @ 2022-12-20 10:48 翠微 编辑
摘要:查询状态 SHOW FULL PROCESSLIST Command状态 Sleep:线程正在等待客户端发送新请求Query:线程正在执行查询或者正在将结果发送给客户端Locked:等待表锁Analyzing and statistics:线程正在手机存储引擎的统计信息,并生成查询的执行计划Copy 阅读全文
posted @ 2022-11-11 22:58 翠微 编辑
摘要:主键使用整数效率高,雪花ID是19位,bigint最大值 9223372036854775807,但是JS无法存储这么长的位数,所以要转化为字符串给前端 https://blog.csdn.net/peng2hui1314/article/details/104610819 1、覆盖索引扫描 索引中 阅读全文
posted @ 2022-11-11 22:24 翠微 编辑
摘要:# 导出 mysqldump -uroot -p123456 dbname > /data_back.dump # 导入 mysql -uroot -p123456 dbname < /data_back.dump docker 导出 docker exec mysql mysqldump -uro 阅读全文
posted @ 2022-11-04 10:24 翠微 编辑
摘要:结论:写sql时应当遵循"小表驱动大表"的原则 IN执行顺序,先查出order表放入内存,然后再和user表进行笛卡尔乘积,最后根据user表的条件保留记录。子查询结果少则速度快。 SELECT u.* FROM `user` u WHERE u.id IN ( SELECT o.user_id F 阅读全文
posted @ 2022-10-29 19:38 翠微 编辑
摘要:select table_name from information_schema.tables where table_schema = database() and table_name='user' 阅读全文
posted @ 2022-10-09 17:22 翠微 编辑
摘要:去重聚合获取count值 SELECT count(DISTINCT(字段)) FROM 表 带null去重聚合count值 SELECT count(DISTINCT(IFNULL(字段,1))) FROM 表 阅读全文
posted @ 2022-08-23 10:41 翠微 编辑
摘要:【MySQL】优化 性能查看 1、解释SQL,explain 2、show profile mysql 5.1以后版本引入的 开启 mysql> set profiling = 1; 给每一个查询生成一个整形的标识 mysql> show profiles; 查看查询具体耗时在哪里 mysql> s 阅读全文
posted @ 2022-07-22 11:08 翠微 编辑
摘要:https://blog.csdn.net/weixin_39922374/article/details/110665140 https://blog.csdn.net/weixin_45699541/article/details/126518330 正确地创建和使用索引是实现高性能查询的基础。 阅读全文
posted @ 2022-02-11 10:20 翠微 编辑
摘要:【MySql】语法学习 1、join 链接 1、join 链接 官方文档:https://dev.mysql.com/doc/refman/8.0/en/join.html table_references: escaped_table_reference [, escaped_table_refe 阅读全文
posted @ 2020-04-14 10:22 翠微 编辑
摘要:【MySql】日期时间 1、查询条件 2、常用函数 3、整数转日期 4、日期函数 有 datetime 类型字段 publish_time 1、查询条件 库中存储 2004-02-04 格式 where DATE(publish_time) = '2004-02-04' 库中存储 08:08:08  阅读全文
posted @ 2020-02-04 08:01 翠微 编辑
摘要:1、太多的连接 Too many connections 2、this is incompatible with sql_mode=only_full_group_by 3、group_concat长度限制 4、错误日志配置 5、max_binlog_cache_size 1、太多的连接 Too m 阅读全文
posted @ 2019-12-06 09:38 翠微 编辑
摘要:https://dev.mysql.com/doc/refman/5.7/en/join.html 1、JOIN语法 table_references: table_reference [, table_reference] … table_reference: table_factor | joi 阅读全文
posted @ 2019-11-01 16:08 翠微 编辑
摘要:【docker】使用学习 目录 1、docker 安装 2、mysql 安装 3、rabbitmq 安装 4、radis 安装 5、jdk 安装 6、nginx 安装 7、elasticsearch 安装 8、vim 安装 9、Alpine Linux 3.9 安装 GraphicsMagick 1 阅读全文
posted @ 2019-05-16 22:21 翠微 编辑

点击右上角即可分享
微信分享提示