mysql 常用操作(错误)

1、mysql 5.7 关于group by 错误:

(1)临时性设置:重启后错误还是存在

select @@global.sql_mode;
set @@global.sql_mode ='STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION';

(2)找到my.cnf文件,添加到最后,重启mysql服务 service mysql restart

[mysqld]
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

2、mysql 新增多条其他表查询数据:

INSERT INTO sys_role_auth (role_id,auth_id)(SELECT 1,auth_id from sys_auth); 

3、nginx解决图片跨域访问问题:

img访问配置中新增:

add_header Access-Control-Allow-Origin *;

add_header Access-Control-Allow-Headers X-Requested-With;

add_header Access-Control-Allow-Methods GET,POST,OPTIONS;

4、更改表字段编码

ALTER TABLE life_goods CONVERT TO CHARACTER SET  utf8mb4 COLLATE utf8mb4_general_ci;

5、更新字段为另一张表字段

UPDATE life_purchase,life_goods SET life_purchase.price =  life_goods.dis_price WHERE life_purchase.goods_id = life_goods.goods_id AND life_purchase.period = 20200604

6、navicat查看所有进程:show processlist; 杀死等待的或卡死的进程: kill PID;(有些守护进程杀不死,请使用kill -9 PID

posted @ 2020-01-21 15:35  FkLee  阅读(168)  评论(0编辑  收藏  举报