gpt4 book ai didi

mysql - 无效的默认值

转载 作者:行者123 更新时间:2023-11-29 03:54:13 26 4
gpt4 key购买 nike

MySQL 发行版 5.5.31

由于字符集不正确,我放弃了旧数据库。所以我尝试创建新的数据库并加载正确的转储。我之前也有一个旧版本的mysql。

创建 BD 和加载转储时出现以下错误:

ERROR 1067 (42000) at line 225234: Invalid default value for 'ts_created'
ERROR 1146 (42S02) at line 225243: Table 'ardostore.toc_piwik_site' doesn't exist
ERROR 1067 (42000) at line 225252: Invalid default value for 'date_registered'
ERROR 1146 (42S02) at line 225263: Table 'ardostore.toc_piwik_user' doesn't exist

225234:

create table toc_piwik_site (
idsite int(10) unsigned not null auto_increment,
name varchar(90) not null,
main_url varchar(255) not null,
ts_created timestamp default 'CURRENT_TIMESTAMP' not null,
feedburnerName varchar(100),
PRIMARY KEY (idsite)
);

225243:

insert into toc_piwik_site (idsite, name, main_url, ts_created, feedburnerName) values ('1', 'Store Name', 'http://ardostore.com', '2012-10-18 19:58:49', NULL);
drop table if exists toc_piwik_site_url;
create table toc_piwik_site_url (
idsite int(10) unsigned not null,
url varchar(255) not null,
PRIMARY KEY (idsite, url)
);

225252:

create table toc_piwik_user (
login varchar(100) not null,
password char(32) not null,
alias varchar(45) not null,
email varchar(100) not null,
token_auth char(32) not null,
date_registered timestamp default 'CURRENT_TIMESTAMP' not null,
PRIMARY KEY (login),
UNIQUE uniq_keytoken (token_auth)
);

225263

insert into toc_piwik_user (login, password, alias, email, token_auth, date_registered) values ('toc_piwik_view', '5f4dcc3b5aa765d61d8327deb882cf99', 'toc_piwik_view', 'sonarius@gmail.com', 'a674bf3fe5d9c0651ac32b28fcbe74f8', '2012-10-18 19:58:49');
drop table if exists toc_piwik_user_dashboard;
create table toc_piwik_user_dashboard (
login varchar(100) not null,
iddashboard int(11) not null,
layout text not null,
PRIMARY KEY (login, iddashboard)
);

UPD

ERROR 1170 (42000) at line 225099: BLOB/TEXT column 'query' used in key specification without a ke                                         y length

create table toc_piwik_log_profiling (
query text not null,
count int(10) unsigned,
sum_time_ms float,
UNIQUE query (query)
);

是什么导致了这个问题?以及如何修复?

最佳答案

默认值 'CURRENT_TIMESTAMP' 是一个字符串。删除引号,它将起作用:

create table toc_piwik_site (
idsite int(10) unsigned not null auto_increment,
name varchar(90) not null,
main_url varchar(255) not null,
ts_created timestamp default CURRENT_TIMESTAMP not null,
feedburnerName varchar(100),
PRIMARY KEY (idsite)
);

关于mysql - 无效的默认值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20372881/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com