一、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
) ;