› MySQL 5.5 Community Server
› MySQL 5.6 Community Server
› Percona Configuration Wizard
› XtraBackup 搭建主从复制
Great Sites on MySQL
› Percona
› MySQL Performance Blog
› Severalnines
推荐管理工具
› Sequel Pro
› phpMyAdmin
推荐书目
› MySQL Cookbook
MySQL 相关项目
› MariaDB
› Drizzle
参考文档
› http://mysql-python.sourceforge.net/MySQLdb.html
armoni
V2EX  ›  MySQL

mysql的datetime列设默认值为now()的问题

  •  
  •   armoni · Jun 6, 2013 · 6914 views
    This topic created in 4871 days ago, the information mentioned may be changed or developed.
    之前用自己的服务器创建数据库表的时候经常用now()作为create_time的默认值,一直没问题,这次在公司的windows机器上调试好,把脚本传到cent os上,创建表报错,说Invalid default value for 'create_time', 一查文档,说是不能使用函数作为默认值,you cannot set the default for a date column to be the value of a function such as NOW() or CURRENT_DATE.(http://dev.mysql.com/doc/refman/5.0/en/data-type-defaults.html) ,但在w3cshcool上查到OrderDate datetime NOT NULL DEFAULT NOW(),,说明有人在用now()啊,求解。目前暂时用CURRENT_TIMESTAMP代替了。
    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   6048 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:28 · PVG 11:28 · LAX 20:28 · JFK 23:28
    ♥ Do have faith in what you're doing.