zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    BZOJ 3631 链剖+差分
    BZOJ 1103 DFS序+线段树
    BZOJ 3629 约数和定理+搜索
    198. House Robber
    152. Maximum Product Subarray
    139. Word Break
    132. Palindrome Partitioning II
    120. Triangle
    115. Distinct Subsequences
    97. Interleaving String
  • 原文地址:https://www.cnblogs.com/jn1011/p/12221935.html
Copyright © 2011-2022 走看看