没长正的技术专栏 勤动手、多思考

MySQL常见问题

2014-01-05

阅读:

2020-03-27

一、MySQL常见问题

MySQL 常用语句积累

1. 编码问题

-- 常用数据库编码UTF8,特殊表情等需要4字节。 所以需要转换为可支持4个字节的utf8mb4_unicode编码(区分大小写)

数据库编码

2. 配置问题

2.1 connection errors

Host is blocked because of many connection errors.Unblock with ‘mysqladmin flush-hosts

解决because of many connection errors

3. 删除重复数据

3.1 删除重复数据并保留一条


DELETE 
FROM
	student 
WHERE
	id NOT IN 
	( 
    	SELECT id FROM 
    	( 
        	SELECT min( id ) AS id 
        	FROM student GROUP BY id_card, `name` 
    	) AS a 
	);

-- zmm

delete from student a 
where a.id != 
(
select min(b.id) from student b where a.name=b.name and a.id_card = b.id_card
) ;


参考

删除重复-参考文档

菜鸟教程


欢迎拍砖,多多交流,转载请注明出处:[没长正的技术专栏](http://blog.meizhangzheng.com) 如涉及侵权问题,请发送邮件到xsj34567@163.com,如情况属实本人将会尽快删除。


上一篇 MySQL之索引

下一篇 Redis

Comments

Content