![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
mysql
qq_40414209
这个作者很懒,什么都没留下…
展开
-
修改MySQL的字符集为utf8mb4
修改数据库配置文件my.cnf [client] default-character-set=uft8mb4 [mysql] default-character-set=uft8mb4 [mysqld] character-set-server = utf8mb4 collation-server = utf8mb4_unicode_ci ## 这两条要放配置文件最底下,不然启动会报错原创 2021-03-22 10:18:18 · 184 阅读 · 0 评论 -
mysql 删除重复数据
表结构 删除重name 等于repeat重复的记录 delete from student where name = 'repeat' and id not in (select * from ( select min(id) from student where name = 'repeat') as s2); 删除所有重复的记录 select id from ( select min(id) as id from student GROUP BY name HAVING COUNT(name) &原创 2020-08-09 16:38:22 · 120 阅读 · 0 评论 -
mysql 主键修改为自增
set foreign_key_checks = 0; alter table user change id id int auto_increment; set foreign_key_checks = 1;原创 2020-03-16 16:15:30 · 405 阅读 · 0 评论 -
ERROR 1217 (23000) at line 730: Cannot delete or update a parent row: a foreign key constraint fails
MySQL库中有俩表,table1和table2,相互关联,在删除表的时候出错: 很明显这是表关联生成的强制约束问题,在删除的时候回检查表之间的关联关系,从而导致无法删除。 解决办法: SET foreign_key_checks = 0; // 先设置外键约束检查关闭 drop table table1; // 删除表,如果要删除视图,也是如此 SET foreign_key_che...转载 2019-11-23 00:09:26 · 127 阅读 · 0 评论 -
mysql 查看当前使用的配置文件my.cnf的方法
原文 使用locate my.cnf命令可以列出所有的my.cnf文件 locate my.cnf 查看是否使用了指定目录的my.cnf ps aux|grep mysql|grep 'my.cnf' 如果上面的命令没有输出,表示没有设置使用指定目录的my.cnf。 查看mysql启动时读取配置文件的默认目录 mysql --help|grep 'my.cnf' 顺序排前的优先。 启动时没有...转载 2019-11-22 23:51:13 · 111 阅读 · 0 评论 -
mysql学习
远程登录mysql: mysql -h ip -u username -p -P 3306 C:\Users\I>mysql -h 192.168.1.104 -u root -p -P 3306 Enter password: * Welcome to the MySQL monitor. Commands end with ; or \g. 设置和重设用户密码 1.查看密码 se...原创 2019-11-22 21:14:01 · 88 阅读 · 0 评论 -
MySQL的的的sql_mode合理设置
原文 当前SQL模式设置 mysql> SELECT @@GLOBAL.sql_mode; +--------------------------------------------+ | @@GLOBAL.sql_mode | +--------------------------------------------+ | STRICT_T...转载 2019-09-25 21:06:21 · 62 阅读 · 0 评论