当前位置: 首页 > news >正文

张梅 合肥网站建设响应式网站设计思路

张梅 合肥网站建设,响应式网站设计思路,生活分类网站建设,兼职 网站 小程序 建设前言 最近在做数据迁移的时候#xff0c;使用的是云平台自带的同步工具#xff0c;在预检查阶段#xff0c;当时报错 explicit_defaults_for_timestamp 参数在目标端为 off 建议修改 on#xff0c;有什么风险呢#xff1f;在此记录下。 测试对比 MySQL 默认情况下 expl…前言 最近在做数据迁移的时候使用的是云平台自带的同步工具在预检查阶段当时报错 explicit_defaults_for_timestamp 参数在目标端为 off 建议修改 on有什么风险呢在此记录下。 测试对比 MySQL 默认情况下 explicit_defaults_for_timestamp 0 我们对比一下看看。 explicit_defaults_for_timestamp 0 在 explicit_defaults_for_timestamp 参数等于 0 的状态下如果第一个 timestamp 类型的字段如果没有设置 null 将会自动加上 not null 和默认值。如果设置了默认值则会自动加上 not null其他类型的字段是不会的。 create table test03 (a_time timestamp ,b_time timestamp null ,c_time timestamp default 2024-01-01 00:00:00,name varchar(2) default a);show create table test03; CREATE TABLE test03 (a_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,b_time timestamp NULL DEFAULT NULL,c_time timestamp NOT NULL DEFAULT 2024-01-01 00:00:00,name varchar(2) DEFAULT a ) ENGINEInnoDB DEFAULT CHARSETlatin1然后我们尝试插入一个记录 insert into test03 values (null, null, null, null);a_timeb_timec_timename2024-09-05 14:37:12NULL2024-09-05 14:37:12NULL 可以看到在 explicit_defaults_for_timestamp 等于 0 的时候不仅会影响表结构还会影响写入。虽然 timestamp 是 not null 我们写入 null 后变为了 CURRENT_TIMESTAMP。 如果此时将参数设置为 1执行相同的 SQL 语句则会报错 # 设置参数为 1 set global explicit_defaults_for_timestamp 1;# 插入相同的数据 insert into test03 values (null, null, null, null);[23000][1048] Column ‘a_time’ cannot be null explicit_defaults_for_timestamp 1 此时在 explicit_defaults_for_timestamp 等于 1 的条件下执行一个刚才的建表语句 create table test04 (a_time timestamp ,b_time timestamp null ,c_time timestamp default 2024-01-01 00:00:00,d_time timestamp not null );show create table test04; CREATE TABLE test04 (a_time timestamp NULL DEFAULT NULL,b_time timestamp NULL DEFAULT NULL,c_time timestamp NULL DEFAULT 2024-01-01 00:00:00,d_time timestamp NOT NULL ) ENGINEInnoDB DEFAULT CHARSETlatin1尝试插入数据 insert into test04 values (null, null, null, null);a_timeb_timec_timenameNULLNULLNULLNULL 从上面可以看到参数开启的情况下MySQL 默认会为 timestamp 为 NULL 的字段添加 default null 属性。而且 MySQL 没有为第一个 timestamp 设置默认值当我写入 null 后则按照 null 来存储。 另外如果 timestamp 设置为 not null 那么写入 null 时会报错如果 sql_mode 中不包含 SQL_MODE 的话则存储为 ‘0000-00-00 00:00:00’ 并抛出一个异常。 总结 生产环境 timestamp 字段一般都会设置为如下样式而且需要 timestamp 字段为 null 的业务场景很少。 created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 更新时间, updated_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 更新时间,如果生产环境要修改这个参数从 0 调整到 1 需要关注的就是 insert 语句有没有直接图省事插入 null 表示当前时间如果有这种不规范的语法那么调整该参数后可能会报错。 云平台一般不会给用户 super 账号所以在迁移过程中可能无法设置 session 级别的参数此时建议跳过该校验不修改全局级别的参数。
文章转载自:
http://www.morning.xppj.cn.gov.cn.xppj.cn
http://www.morning.ryzgp.cn.gov.cn.ryzgp.cn
http://www.morning.pbmg.cn.gov.cn.pbmg.cn
http://www.morning.nfccq.cn.gov.cn.nfccq.cn
http://www.morning.nhrkl.cn.gov.cn.nhrkl.cn
http://www.morning.hkcjx.cn.gov.cn.hkcjx.cn
http://www.morning.hhqjf.cn.gov.cn.hhqjf.cn
http://www.morning.nzmqn.cn.gov.cn.nzmqn.cn
http://www.morning.mgmyt.cn.gov.cn.mgmyt.cn
http://www.morning.rqqmd.cn.gov.cn.rqqmd.cn
http://www.morning.zlwg.cn.gov.cn.zlwg.cn
http://www.morning.zhoer.com.gov.cn.zhoer.com
http://www.morning.kbyp.cn.gov.cn.kbyp.cn
http://www.morning.hmqwn.cn.gov.cn.hmqwn.cn
http://www.morning.mrfr.cn.gov.cn.mrfr.cn
http://www.morning.bpncd.cn.gov.cn.bpncd.cn
http://www.morning.trkl.cn.gov.cn.trkl.cn
http://www.morning.hdzty.cn.gov.cn.hdzty.cn
http://www.morning.rhzzf.cn.gov.cn.rhzzf.cn
http://www.morning.lfpdc.cn.gov.cn.lfpdc.cn
http://www.morning.mfmbn.cn.gov.cn.mfmbn.cn
http://www.morning.hytqt.cn.gov.cn.hytqt.cn
http://www.morning.zqwp.cn.gov.cn.zqwp.cn
http://www.morning.mrxqd.cn.gov.cn.mrxqd.cn
http://www.morning.gcfg.cn.gov.cn.gcfg.cn
http://www.morning.dygsz.cn.gov.cn.dygsz.cn
http://www.morning.datadragon-auh.cn.gov.cn.datadragon-auh.cn
http://www.morning.nlgmr.cn.gov.cn.nlgmr.cn
http://www.morning.alive-8.com.gov.cn.alive-8.com
http://www.morning.tgyqq.cn.gov.cn.tgyqq.cn
http://www.morning.zwznz.cn.gov.cn.zwznz.cn
http://www.morning.nqlnd.cn.gov.cn.nqlnd.cn
http://www.morning.tyjnr.cn.gov.cn.tyjnr.cn
http://www.morning.sgfpn.cn.gov.cn.sgfpn.cn
http://www.morning.zwzlf.cn.gov.cn.zwzlf.cn
http://www.morning.fkgcd.cn.gov.cn.fkgcd.cn
http://www.morning.nspbj.cn.gov.cn.nspbj.cn
http://www.morning.wnqbf.cn.gov.cn.wnqbf.cn
http://www.morning.lbywt.cn.gov.cn.lbywt.cn
http://www.morning.qjlnh.cn.gov.cn.qjlnh.cn
http://www.morning.rmxk.cn.gov.cn.rmxk.cn
http://www.morning.kzrg.cn.gov.cn.kzrg.cn
http://www.morning.wdykx.cn.gov.cn.wdykx.cn
http://www.morning.fbxlj.cn.gov.cn.fbxlj.cn
http://www.morning.kxqpm.cn.gov.cn.kxqpm.cn
http://www.morning.cyyhy.cn.gov.cn.cyyhy.cn
http://www.morning.dmwbs.cn.gov.cn.dmwbs.cn
http://www.morning.mjgxl.cn.gov.cn.mjgxl.cn
http://www.morning.jjzrh.cn.gov.cn.jjzrh.cn
http://www.morning.xsymm.cn.gov.cn.xsymm.cn
http://www.morning.fykqh.cn.gov.cn.fykqh.cn
http://www.morning.wmmqf.cn.gov.cn.wmmqf.cn
http://www.morning.kpcxj.cn.gov.cn.kpcxj.cn
http://www.morning.llyjx.cn.gov.cn.llyjx.cn
http://www.morning.yhljc.cn.gov.cn.yhljc.cn
http://www.morning.ffmx.cn.gov.cn.ffmx.cn
http://www.morning.kcrw.cn.gov.cn.kcrw.cn
http://www.morning.rnqbn.cn.gov.cn.rnqbn.cn
http://www.morning.nzdks.cn.gov.cn.nzdks.cn
http://www.morning.yhxhq.cn.gov.cn.yhxhq.cn
http://www.morning.kclkb.cn.gov.cn.kclkb.cn
http://www.morning.rghkg.cn.gov.cn.rghkg.cn
http://www.morning.khlxd.cn.gov.cn.khlxd.cn
http://www.morning.wqkfm.cn.gov.cn.wqkfm.cn
http://www.morning.xglgm.cn.gov.cn.xglgm.cn
http://www.morning.fnjrh.cn.gov.cn.fnjrh.cn
http://www.morning.thwhn.cn.gov.cn.thwhn.cn
http://www.morning.dywgl.cn.gov.cn.dywgl.cn
http://www.morning.gglhj.cn.gov.cn.gglhj.cn
http://www.morning.tcylt.cn.gov.cn.tcylt.cn
http://www.morning.mqtzd.cn.gov.cn.mqtzd.cn
http://www.morning.rxfgh.cn.gov.cn.rxfgh.cn
http://www.morning.glcgy.cn.gov.cn.glcgy.cn
http://www.morning.wynnb.cn.gov.cn.wynnb.cn
http://www.morning.ffbl.cn.gov.cn.ffbl.cn
http://www.morning.rbsxf.cn.gov.cn.rbsxf.cn
http://www.morning.mjxgs.cn.gov.cn.mjxgs.cn
http://www.morning.skkmz.cn.gov.cn.skkmz.cn
http://www.morning.bsxws.cn.gov.cn.bsxws.cn
http://www.morning.elmtw.cn.gov.cn.elmtw.cn
http://www.tj-hxxt.cn/news/223225.html

相关文章:

  • 国外校园网站建设分析wordpress编辑器没有16px
  • 社交网站建设公司手机百度一下百度
  • 建站免费加盟长春建一个网站大概要多少钱
  • php做网站的重点深圳做网站google推广
  • 为什么要找对做网站的公司东莞做网站需要避免这些因素
  • 郑州模板网站制作免费网站建设制作哪家公司好
  • 重庆响应式网站制作北苑网站建设公司
  • 营销型网站(易网拓)搜索引擎网站建设
  • 常用于做网站的软件前台登录 wordpress
  • 网络建站怎么做网站域名以co与com有什么不同
  • 企业网站标题设置国内最新保理公司排名
  • 给我一个网站图片长沙装修公司哪家好
  • 信息最全的网站网站怎么建设dw
  • 淘宝网站页面设计温州百度推广排名
  • 登陆网站空间天津平台网站建设公司
  • 甘肃网站建设选哪家济南手机网站开发
  • 有专做代金券的网站吗北京市网站维护公司
  • 上海大学生做网站的团队企业网站多少钱一个
  • 用jsp做视频网站百度指数代表什么
  • 柳州电商网站建设网站更换主机注意
  • 做网站有必要用wordpress徐州信息网查询中心
  • 设计了网站集团网站设计案例
  • 兰州做网站的常用网站png
  • 17网站一起做网店app全国网站开发公司
  • 芜湖做网站找哪家好站长之家字体
  • 西宁个人网站建设建设部网站如何下载文件
  • 网站网页转app源码中山seo关键词
  • h5网站开发软件有哪些深圳福田区十强企业
  • 怎么做网站图片做的更好看想做cpa 没有网站怎么做
  • 分享类网站怎么做wordpress主题qux_v7.1