遇到的问题

1.连接数问题

之前遇到过数据库的连接数满了,应该是配置的jdbc的数量太多,看看数据库配置,所支持的最大连接数多少


image.png

image.png

image.png

原因是sleep 会话太多,sleep是jdbc连接池 与mysql的空闲连接,一个会话会占一个连接,当时把mysql 的wait_timeout 参数设置100s,又引发出 Can not read response from server. Expected to read 4 bytes, read 0 bytes before connection was unexpectedly lost. 这个问题,原因是,这个sleep 超时自动释放,但是代码里面刚好在释放前拿到这个空闲连接,导致sql执行的时候丢失链接 报错,所以解决方案是配置少的jdbc连接数

2.负载问题,删除进程sql

show PROCESSLIST

kill 33840929

select * from information_schema.processlist where user='jxmoney' and state = '' and time > 1000 order by time asc

select * from information_schema.processlist where user='jxmoney' and time > 50

select concat('KILL ',id,';') from information_schema.processlist where user='jxmoney' and time > 50

SELECT CONCAT('kill ',id,';') AS KillSQL FROM information_schema.PROCESSLIST WHERE info LIKE
'%Alert table%'

3.ASCII问题

手机号不对的问题
SELECT id,ASCII(user_account),length(user_account) c,u.user_account from back_user u where length(user_account) > 12

image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容