新聞中心
MySQL設(shè)置當(dāng)前時(shí)間為默認(rèn)值的問題我們經(jīng)常會(huì)遇到,下面就為您介紹MySQL設(shè)置當(dāng)前時(shí)間為默認(rèn)值的實(shí)現(xiàn)全步驟,希望對(duì)您能有所啟迪。

十載的湯原網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都全網(wǎng)營銷的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整湯原建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。成都創(chuàng)新互聯(lián)公司從事“湯原網(wǎng)站設(shè)計(jì)”,“湯原網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
數(shù)據(jù)庫:test_db1
創(chuàng)建表:test_ta1
兩個(gè)字段:id (自增 且為主鍵),
createtime 創(chuàng)建日期(默認(rèn)值為當(dāng)前時(shí)間)
方法一、是用alert table語句:
- use test_db1;
- create table test_ta1(
- id mediumint(8) unsigned not nulll auto_increment,
- createtime datetime,
- primary key (id)
- )engine=innodb default charset=gbk;
- alert table test_ta1 change createtime createtime timestamp not null default now();
方法二、直接創(chuàng)建方便:
- use test_db1;
- create table test_ta1(
- id mediumint(8) unsigned not nulll auto_increment,
- createtime timestamp not null default current_timestamp,
- primary key (id)
- )engine=innodb default charset=gbk;
方法三、可視化工具如 mysql-front
右擊createtime屬性
把Type屬性值改為timestamp
default 屬性選擇
以上就是MySQL設(shè)置當(dāng)前時(shí)間為默認(rèn)值的方法介紹。
【編輯推薦】
MySQL分表處理的實(shí)現(xiàn)方法
MySQL授權(quán)表使用示例
MySQL多表刪除的實(shí)現(xiàn)
MySQL獨(dú)立表空間的優(yōu)缺點(diǎn)
mysql數(shù)據(jù)庫大小寫的問題討論
本文名稱:MySQL設(shè)置當(dāng)前時(shí)間為默認(rèn)值的方法
網(wǎng)站網(wǎng)址:http://m.fisionsoft.com.cn/article/dpdsopj.html


咨詢
建站咨詢
