![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mysql
qq_31683775
这个作者很懒,什么都没留下…
展开
-
mysql 查询修改一条sql
UPDATE yx_user tINNER JOIN ( SELECT real_name, uid FROM yx_user ) t2 ON t2.uid = t.spread_uid SET t.spread_username = t2.real_name WHERE t.uid = '39'原创 2021-08-31 12:00:49 · 338 阅读 · 0 评论 -
mysql 分组后 把右表指定字段用逗号分割 GROUP_CONCAT()用法
左表连接右表,左表中的一行匹配右表中的多行,怎样把右表匹配的多行,指定字段用逗号拼接为一行?SELECT st.id, st.NAME, GROUP_CONCAT( tu.u_id ) uids FROM yx_sale_team st LEFT JOIN yx_team_user tu ON tu.t_id = st.id WHERE st.is_del = 0 GROUP BY st.id...原创 2021-07-24 15:42:58 · 553 阅读 · 0 评论 -
mysql 字段中包含“,“ 怎样拆开连接表
假如一张表字段中包含 "," 实际上是存储的值按逗号分割了,并且存储的是另一张表的id,现在我们怎样把它拆开后连接另一张表?参考https://www.cnblogs.com/zhaoyongjie-z/p/11506608.html主要就是在on 后面使用FIND_IN_SET 函数FIND_IN_SET(字表id,主表外键字段)我这里连了三张表,按需求连两张也可以SELECT o.id, o.cart_id, c.id, p.id FROM yx_store_ord..原创 2021-07-15 10:54:43 · 210 阅读 · 3 评论 -
安装mysql5.7.34解压版
下载mysql解压版1. 官网(https://dev.mysql.com/downloads/mysql/5.7.html)下载mysql5.7.34,选择zip;2. 解压目录的C盘;3. 在目录下添加data文件夹,文件夹为空;添加my.ini文件,文件内容如下;[mysql]# 设置mysql客户端默认字符集default-character-set=utf8 [mysqld]#设置3306端口port = 3306 # 设置mysql的安装目录..原创 2021-07-12 10:08:45 · 390 阅读 · 1 评论 -
安装mysql Install/Remove of the Service Denied!错误的解决办法
在windos 的cmd下安装mysql在mysql的bin目录下面执行: mysqld --install报错:信息如下:Install/Remove of the Service Denied解决办法:打开cmd.exe程序的时候选择“用管理员身份打开”。原创 2020-08-16 17:06:03 · 157 阅读 · 0 评论 -
windows10 安装mysql-8.0.19 解压版
首先下载压缩包http://mirrors.163.com/mysql/Downloads/MySQL-8.0/mysql-8.0.19-winx64.zip解压到d盘D:\mysql-8.0.19-winx64\ 目录新建 my.ini 文件[mysql]# 设置mysql客户端默认字符集default-character-set=utf8mb4[mysqld]# 设...原创 2020-02-12 12:23:03 · 510 阅读 · 0 评论 -
liunx 重新初始化mysql
删除/usr/local/mysql/mysql-5.7.28mysql安装目录的数据目录data/./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/mysql-5.7.28 --datadir=/usr/local/mysql/mysql-5.7.28/data要记录成功后的密码...原创 2020-02-07 20:42:13 · 3038 阅读 · 1 评论 -
安装mysql时修改密码和配置远程访问
修改密码set password=password('xxx');grant all privileges on *.* to root@'%' identified by 'xxx';flush privileges;配置远程访问use mysql;update user set host='%' where user = 'root';flush privileges;...原创 2020-02-07 20:39:20 · 113 阅读 · 0 评论 -
liunx 安装 mysql 时遇到错误的解决
第一个错误用服务的方式启动mysql后 报错ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)后来的mysql的my.cfg配置文件中 发现 basedir 是已 / 结尾的我觉得mysql要的是一个目录 而不是目录下的文件夹和文件后来我把 末尾的 / 去掉不报错了第二个错误用服务的方...原创 2020-01-21 10:16:23 · 3002 阅读 · 0 评论 -
mysql 查询时间段之间的记录
SELECT count(1)FROM tb_orderWHERE pay_amount <> ''AND is_shipping = 1AND create_time BETWEEN date_format( '2020-1-14 17:28:31', '%Y-%m-%d %H:%i:%S' )AND date_format( '2020-01-15 17:28:3...原创 2020-01-15 18:18:42 · 253 阅读 · 0 评论 -
报错 The last packet successfully received from the server was 510,815 milliseconds ago. The last pac
报错:The last packet successfully received from the server was 510,815 milliseconds ago. The last packet sent successfully to the server was 0 milliseconds ago.原因大概是mysql在一定时间内,关闭了一些链接,但是java数据库链...原创 2019-12-30 11:44:45 · 2203 阅读 · 0 评论 -
mybatis 批量更新
但Mybatis映射文件中的sql语句默认是不支持以" ; " 结尾的,也就是不支持多条sql语句的执行。所以需要在连接mysql的url上加 &allowMultiQueries=true 这个才可以执行。<update id="batchUpdate" parameterType="list"> <foreach collection="list" i...原创 2019-12-20 16:53:28 · 59 阅读 · 0 评论 -
mysql 分组显示行号
SELECT a.*, @group_row := CASEWHEN @toUser = a.toUser THEN @group_row + 1ELSE 1END AS groupRow, @toUser := a.toUser AS toUserFROM ( SELECT t.*, CASE WHEN t.message_create_user_id = '1...原创 2019-12-19 11:44:53 · 510 阅读 · 0 评论 -
SELECT list is not in GROUP BY clause and contains nonaggregated column 'school.sc.class_name' which
SELECT list is not in GROUP BY clause and contains nonaggregated column 'school.sc.class_name' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=onl...原创 2019-12-13 13:58:44 · 108 阅读 · 0 评论 -
window 安装 mysql8.0.12
https://www.jb51.net/article/146115.htmhttps://www.cnblogs.com/laumians-notes/p/9069498.htmlliunx 安装mysqlhttps://blog.csdn.net/lch520baby/article/details/89081306原创 2019-12-11 11:19:37 · 94 阅读 · 0 评论 -
mysql 判断 字符串为空和空白字符串
ISNULL(aBegBalRule) || LENGTH(trim(aBegBalRule))<1原创 2019-12-10 11:55:52 · 6358 阅读 · 0 评论 -
Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column ‘sss.month_
Expression #2 of SELECT list is not in GROUP BY clause and containsnonaggregated column ‘sss.month_id’ which is not functionallydependent on columns in GROUP BY clause; this is incompatible withsql...原创 2019-12-09 16:43:15 · 141 阅读 · 0 评论 -
liunx mysql 设置 数据库为 utf8mb4
配置完my.cnf后# For advice on how to change settings please see# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html# *** DO NOT EDIT THIS FILE. It's a template which will be co...原创 2019-12-09 09:58:41 · 451 阅读 · 0 评论 -
Starting MySQL.The server quit without updating PID file (/[FAILED]l/mysql/mysql-5.7.28/data/mysqld.
2个小时......原因是没有权限,必须把data文件夹,赋权给mysql组.chown -R mysql:mysql /usr/local/mysql/mysql-5.7.28/dataStarting MySQL.. [ OK ]终于起来了...原创 2019-12-07 21:49:35 · 3385 阅读 · 0 评论 -
MySQL插入emoji表情错误的3种解决方案,Incorrect string value: '\xF0\x9F\x98\x84'
Incorrect string value: '\xF0\x9F\x91\x84\u...' for column 'message_content' at row 175修改mysql的配置文件,windows下的为安装目录的my.ini(linux下的为/etc/my.cnf),修改的内容都一样[client]default-character-set = utf8mb4...原创 2019-12-07 18:39:15 · 202 阅读 · 0 评论